Class: Float

Inherits:
Object show all
Defined in:
lib/darkext/float.rb

Instance Method Summary collapse

Instance Method Details

#equals?(x, tolerance = 1e-6) ⇒ Boolean

Equals for floats with tolerance

Returns:

  • (Boolean)


3
4
5
# File 'lib/darkext/float.rb', line 3

def equals?(x, tolerance = 1e-6)
  (self - x).abs < tolerance
end