How to calculate Min and Max values for IEEE Extended Double precision?
I know that the min and values are:
min:3.362... 10-4932
max:1.189... 10+4932
and (2^14) * log(2) ~ 4932
which gives me the exponential pa开发者_开发问答rt. But I can't figure out mantissa.Mantissa has an implicit beginning one bit. This avoids wasting one bit of storage for the bit which is always one (except for reduced floats, which are a special case when all exponent bits are zero).
Notice that the implicit first digit is only possible in binary. E.g. in decimal you might have 3.14e+2 and you cannot just drop the first digit (3) because you wouldn't know which number (1-9 it was anymore.
For example, a floating point value seeemmmmm would be read as (in C-style pseudo code)
(s ? -1 : 1) * ((binary)1mmmmm << ((binary)eee - bias));
Where bias is a constant for this particular floating-point type so that all exponent values (eee) can be positive and 000 is the most negative exponent.
So, you can calculate the maximum value by 0b111111 (one more bit than there is in the mantissa) shifted by the maximum value (unbiased) of the exponent. The minimum value is the same with a negative sign.
精彩评论