Class: Numeric
- Inherits:
-
Object
- Object
- Numeric
- Defined in:
- lib/evelpidon_core_ext/numeric.rb
Instance Method Summary collapse
-
#within_delta?(expected, delta) ⇒ Boolean
Checks whether self is almost equal to another number within a specified precision.
Instance Method Details
#within_delta?(expected, delta) ⇒ Boolean
Checks whether self is almost equal to another number within a specified precision. Taken from stackoverflow.com/a/239314/75246
4 5 6 |
# File 'lib/evelpidon_core_ext/numeric.rb', line 4 def within_delta?(expected, delta) (expected - self).abs <= delta end |