Considering that:
- == should never be used to compare doubles/floats
- it appears from the docs that (beyond some type-checking and checking against NaN) that's all that Double/Float.equals does
It would seem like Float.equals in its current form is almost completely useless.
Am I missing something, or are there times when it is appropriate to use Float.equals, except in the staggeringly rare case that you want to test for binary equality?
And if so, is it genuinely the done thing to roll your own identikit epsilon function (as recommended in the first link), or is there an existing wrapper for this staggeringly common operation?
Also, does Double/Float.compare suffer from the same issue, or is there a existing comparator that takes an epsilon?
(Note that I can't change the existing libraries from Floats to BigD)