如何将 IEEE 754 单精度浮点格式转换为十进制?
我知道第一位是符号,接下来的 8 位是指数。那么在这个例子中你会有 1.1001*2^-4 吗?那么我该如何用十进制解释它呢?
0 01111011 10010000000000000000000
I understand that the first bit is the sign and that the next 8 bits is the exponent. So in this example you would have 1.1001*2^-4 ? How do I then interpret this in decimal?
0 01111011 10010000000000000000000
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
因为您已经计算出这是(二进制)1.1001*10^-100,所以现在您只需将二进制数转换为十进制数即可。
在十进制中,每个数字的值是其前一位的十分之一。在二进制中,每个数字的值是前一位数字的一半。
首先 1.1001*10^-100 = 0.00011001。
这是...
0.0625 + 0.03125 + 0.00390625 = 0.09765625
这就是它的全部内容。
Since you already figured out that this is (in binary)1.1001*10^-100, now you just have to convert the binary number to decimal.
In decimal, each digit has a value one-tenth as much as the one before it. In binary, each digit has a value one-half as much as the one before it.
First 1.1001*10^-100 = 0.00011001.
Which is...
0.0625 + 0.03125 + 0.00390625 = 0.09765625
That's all there is to it.
1.1001b
是1*1 + 0.5*1 + 0.25*0 + 0.125*0 + 0.0625*1
或1.5625
。将其乘以2**-4
(0.0625
) 即可得到 0.09765625。1.1001b
is1*1 + 0.5*1 + 0.25*0 + 0.125*0 + 0.0625*1
, or1.5625
. Multiply that by2**-4
(0.0625
) to get 0.09765625.在C中:
in C: