class Numeric
Definitions
def close?(to, delta)
Check whether this number is within delta of to.
Signature
-
parameter
toNumeric The target value.
-
parameter
deltaNumeric The allowed deviation.
-
returns
Boolean
Implementation
def close?(to, delta)
(to.to_f - self).abs <= delta.to_f rescue false
end