IEEE-754 32 Bit (single precision) exponent -126 instead of -127

橙三吉。 提交于 2019-12-10 22:38:27

问题


I know if I have a number like that:

1 | 1001 0001 | 0011 0011 0000 0001 0101   000 
1 sign bit | 8 bit biased exponent | 23 bit fraction/mantissa

I can calculate the "real" exponent by subtraction the bias 127 (0111 1111) from biased exponent. I.e. 1001 0001 - 0111 1111 = 10010 (so real Exponent is 18)

1,0011 0011 0000 0001 0101 000 * 2^18

So now my question:

If a have a (denormalized) number like that:

0 | 0000 0000 | 0000 0000 0000 0000 0000   001 

Why the Exponent is -126 and not -127? 0000 0000 - 0111 1111 should be -127 and not -126 so that

0,0000 0000 0000 0000 0000 0001 * 2^-126 and not 0,0000 0000 0000 0000 0000 0001 * 2^-127

Thanks and best regards


回答1:


A denormalized single precision float has an implicit exponent of 2-126:

(−1)signbit×2−126× 0.significandbits

See https://en.wikipedia.org/wiki/Single-precision_floating-point_format for more details.



来源:https://stackoverflow.com/questions/46732247/ieee-754-32-bit-single-precision-exponent-126-instead-of-127

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!