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

flag1 = (3.1416).equals? Math::PI         # false
flag2 = (3.1416).equals?(Math::PI, 0.001) # true

