Re:There Are Only Four Billion Floats–So Test Them All (2014)
by teraflop on Thursday February 09, 2023 @04:51PM
(#34732061)
The quote is talking about code that is supposed to find the ceiling of a number, and does so by adding 0.5 and then rounding to the nearest value (breaking ties by rounding towards even).
If you have a very small but non-zero positive number, it gets rounded to 0.5 after the addition, and then the second rounding incorrectly rounds toward 0 instead of 1.
The result is that you have a value x such that x > ceil(x), which shouldn't ever happen.
If you have a very small but non-zero positive number, it gets rounded to 0.5 after the addition, and then the second rounding incorrectly rounds toward 0 instead of 1.
The result is that you have a value x such that x > ceil(x), which shouldn't ever happen.