2 ms·
Yes, wonderful property. This also means that "next" and "previous" float can generally be computed by just interpreting the value as int and incrementing/decre
by FabHK 7y ago
Yes, wonderful property. This also means that "next" and "previous" float can generally be computed by just interpreting the value as int and incrementing/decrementing by one, which allows easy computation of the epsilon or ULP (unit in the last place) [1].
Minor differences to the total ordering of the ints:
* IEEE NaNs always compare false
* IEEE +zero and -zero compare equal (that's the only case I'm aware of where you can have floats with x == y, but 1/x != 1/y, because +inf != -inf).
[1] Note that the ULP can get pretty large. If you have 1e23 as a float, you can add a million to it, and still get back the same number (because the next float is so far away).