Class: Float

Inherits:
Object
  • Object
show all
Defined in:
lib/m26_ruby_extensions.rb

Overview

Copyright © 2013 Chris Joakim, JoakimSoftware LLC

Instance Method Summary collapse

Instance Method Details

#approximate?(val, tolerance = 0.0001) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'lib/m26_ruby_extensions.rb', line 9

def approximate?(val, tolerance=0.0001)
  return false if (self) > (val + tolerance)
  return false if (self) < (val - tolerance)
  true
end