How should I do floating point comparison?
Comparing for greater/smaller is not really a problem unless you’re working right at the edge of the float/double precision limit. For a “fuzzy equals” comparison, this (Java code, should be easy to adapt) is what I came up with for The Floating-Point Guide after a lot of work and taking into account lots of criticism: … Read more