Create a gist now

Instantly share code, notes, and snippets.

class Float
def near_enough?(other, epsilon = Float::EPSILON)
(self - other.to_f).abs < epsilon.to_f
end
end
@kotp
Owner
kotp commented Mar 16, 2013

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