SP4CEBAR 2024-07-17 00:03 (Edited)
Warning flashing colors
nathanielbabiak 2024-07-17 01:37 (Edited)
I did something similar a while back. It's here if you want to compare/contrast the code:
SP4CEBAR 2024-07-17 08:59 (Edited)
Cool!
Your code is so much smaller than mine :)
I noticed something strange with NX's floats: they range from 2^127 to 2^(-149). I suspect their mantissa are automatically reduced once the lowest exponent (2^(-128) or 2^(-127)) is reached to fit 21 to 22 more exponent levels, this is plausible because the mantissa has a size of 23 bits.
Anyways, NX is better at that than my program, so at around 2^(-127) my program may read a very small value as "0".
nathanielbabiak 2024-07-17 14:50
What you've described is a subnormal encoding. It's within the IEEE standard already. As you've said, the mantissa is reduced all the way down to the float's value of zero, and the high bits of the mantissa are all set to zero, at a loss of precision.
If you go through the IEEE standard a little more you'll find a bunch of stuff on subnormal numbers.
SP4CEBAR 2024-07-18 08:39
Thank you