IEEE-754 32位(单精度)指数-126而不是-127 [英] IEEE-754 32 Bit (single precision) exponent -126 instead of -127

查看:160
本文介绍了IEEE-754 32位(单精度)指数-126而不是-127的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我是否有这样的号码:

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

我可以通过从偏差指数中减去偏差127(0111 1111)来计算真实"指数. IE. 1001 0001-0111 1111 = 10010(所以实际指数为18)

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

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

所以现在我的问题是:

如果a具有这样的(非规范化的)数字:

If a have a (denormalized) number like that:

0 | 0000 0000 | 0000 0000 0000 0000 0000   001 

为什么指数是-126而不是-127? 0000 0000-0111 1111应该是-127,而不是-126,这样

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而不是0,0000 0000 0000 0000 0000 0001 * 2 ^ -127

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

感谢和问候

推荐答案

非规范化的单精度浮点数的隐式指数为2 -126 :

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

(− 1)符号位×2 −126 ×0.significandbits

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

请参见 https://en.wikipedia.org/wiki/Single-precision_floating- point_format 以获得更多详细信息.

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

这篇关于IEEE-754 32位(单精度)指数-126而不是-127的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆