4 ms·
Not guessing at what the original author intended, but the formula `floor(x + 0.5)` does not currently round to the nearest integer for all floating point value
by reichstein 3y ago
Not guessing at what the original author intended, but the formula `floor(x + 0.5)` does not currently round to the nearest integer for all floating point values. If 0.5 is just outside the bits of the mantissa, there will be an intermediate rounding before doing the `floor`.
One such value is 0.49999999999999994, another is 4503599627370497.0
- Kim_Bruning 3y agoOh No. That one isn't even on https://www.ethan-shea.com/posts/falsehoods-about-floats https://www.ethan-shea.com/posts/falsehoods-about-floats yet.