|
|
|
|
|
by reichstein
849 days 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 |
|
That one isn't even on https://www.ethan-shea.com/posts/falsehoods-about-floats yet.