On Tuesday, 10 May 2016 at 07:28:21 UTC, Manu wrote:
Perhaps float comparison should *always* be done at the lower
precision? There's no meaningful way to perform a float/double
comparison where the float is promoted, whereas demoting the
double for the comparison will almost certainly yield the
expected result.
Assuming that's what you want, it's reasonably straightforward to
use
feqrel(someFloat, someDouble) >= float.mant_dig
... to compare to the level of precision that matters to you.
That's probably a better option than adjusting `==` to always
prefer a lower level of precision (because it's arguably accurate
to say that 1.3f != 1.3).