ScampiSourceNumeric

class Numeric

Definitions

def close?(to, delta)

Check whether this number is within delta of to.

Signature

parameter to Numeric

The target value.

parameter delta Numeric

The allowed deviation.

returns Boolean

Implementation

def close?(to, delta)
  (to.to_f - self).abs <= delta.to_f  rescue false
end