Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View float_near_enough.rb
1 2 3 4 5
class Float
def near_enough?(other, epsilon = Float::EPSILON)
(self - other.to_f).abs < epsilon.to_f
end
end
Owner
kotp commented

Greatly error prone for floats less than 1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.