3 ms·
Hmm, could you show a screenshot? When I toggle the rightmost green bit, it doubles the value as expected. Note that float toy doesn't actually show the mantis
by sillysaurusx 7y ago
Hmm, could you show a screenshot? When I toggle the rightmost green bit, it doubles the value as expected.
Note that float toy doesn't actually show the mantissa value, only the final value. So if the value goes from 6.709679e-39 to 1.8464622e-38, then it was doubled.
EDIT: Oh! I see what you mean. I was wrong; obviously it does show the mantissa.
Yes, that seems like a bug. Shouldn't the mantissa always be in the range [0.0 .. 1.0)?
On the other hand, maybe it behaves differently when the exponent is negative. If you don't understand how IEEE754 works, then apparently I don't either, so thanks for pointing that out.
EDIT2: Ok, comparing with https://float.exposed/0x40490fdb https://float.exposed/0x40490fdb makes me more certain that both sites are wrong.
On float.exposed, the exponent can’t ever go negative, which is clearly bogus. Exponent “128” should read “1”. It’s showing the raw binary unsigned value, which is misleading, since you want to know the int8 signed value.
But toggling the exponent bits should never affect the mantissa. That’s also bogus.
I think float toy is the superior visualization, and they should fix the bug. I wonder if there’s anywhere to report it....
- sillysaurusx 7y agoTurns out, there's no bug in float toy. The only case where the mantissa becomes 0.xx instead of 1.xx is when exponent == 0, which is a subnormal number and is working as expected.