3 ms·
I suppose my version might be wrong when it hits a denormal. It would depend on the rounding mode. Also it would never actually get to a denormal. But you're
by Dylan16807 12y ago
I suppose my version might be wrong when it hits a denormal. It would depend on the rounding mode. Also it would never actually get to a denormal.
But you're right that to be obviously correct it should stop when it reaches denormals.
>Your version of 50/50 split with the mantissa will mean that 0 and 1 will be less often chosen than others.
That's intentional, because rounding a real number to the nearest float has the same behavior. The spec is wrong, I advise against following the spec, but that is how you do it.