Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/wrong/close_to.rb
Overview
TODO: make it a module, and optionally include it into Float and Fixnum if asked
Instance Method Summary collapse
Instance Method Details
#close_to?(other, tolerance = 0.001) ⇒ Boolean
4 5 6 |
# File 'lib/wrong/close_to.rb', line 4 def close_to?(other, tolerance = 0.001) (self - other.to_f).abs < tolerance end |