For clarity, if I am using a language that implements IEEE 754 floats and I declare:
float f0 = 0.f; Float F1 = 1. f;
... and then print them back, I'll get 0.0000 and 1.0000 - of course.
But IEEE 754 is not able to represent all the numbers Close to zero with the actual line, the 'interval' is small;
So, my question is: For an IEEE 754 float, which is the first (the closest zero) integer that can not be represented at all? I'm really worried about 32-bit floats for now, although I would be interested in hearing 64-bit replies if someone gives it!
I thought it would be as simple as adding 2 bits_of_mantissa as the calculation and 1, where bits_of_mantissa is the standard which Bits expose bits. I did this for 32-bit floats on my machine (MSVC +, Win64), and it looked ok, though.
2
+1 in the exponent (mantissa bits + 1) is that, if there is abcdef ... in Mantissa
indicating that the number actually is 1.abcdef ... × 2 ^ e
, Which provides an additional built-in bit of precision.
float
, this is 16,777,217 (2 24 + 1). For double
, this is 9,007,199,254,740,993 (2 53 + 1).
& gt; & Gt; & Gt; 9007199254740993.0 9007199254740992
Comments
Post a Comment