Jailout2000

Ballpark Function

Jul 21st, 2011
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Protected Function Ballpark(Value As Double, Median As Double, Variance As Double) As Boolean
  2.  
  3.   '// Calculates mathematically the bounds of value.
  4.  '// Returns true if median is within value, false otherwise.
  5.  '// The margin of error ("the ballpark") is however much you let Variance be.
  6.  
  7.   '// Ballpark For Dummies:
  8.  '// -> Value is what you got.
  9.  '// -> Median is what you thought Value would be.
  10.  '// -> Variance is how much you can be wrong.
  11.  '// <- True means you thought correctly while False means you were wrong.
  12.  
  13.   Return ((Value >= Median - Variance) And (Value <= Median + Variance))
  14.  
  15. End Function
Advertisement
Add Comment
Please, Sign In to add comment