[英]How to convert 601.0 to IEEE-754 Single Precision
I am trying to understand how to convert from decimal to IEEE-754 Single Precision binary representation. 我试图了解如何从十进制转换为IEEE-754单精度二进制表示形式。
I make up a random number which happen to be 601.00 我组成一个随机数,刚好是601.00
I tried my best to figure it out and this is what I got: 我尽力弄清楚了,这就是我得到的:
Step 01: I divided 601 by 9 (since 2^9 is the largest power of 2 divisible by my number) so I got 66.7778 步骤01:我将601除以9(因为2 ^ 9是按数字除以2的最大幂),所以我得到66.7778
Step 02: I have for the exponent 9 + 127 = 136 which is 10001000 in binary. 步骤02:我的指数为9 + 127 = 136,二进制为10001000。 Step 03: The sign is 0
步骤03:符号为0
Right now the representation is: (missing the mantissa) 0 10001000 现在的表示形式是:(缺少尾数)0 10001000
But what is the mantissa representation for 66.7778 in binary? 但是66.7778的尾数表示形式是什么?
Step 1 should be: divide 601 by 2^9, not by 9. 步骤1应该是:将601除以2 ^ 9,而不是除以9。
To get the mantissa, subtract 1 from the result of the division and multiply it by 2^23. 要获得尾数,请从除法结果中减去1,然后将其乘以2 ^ 23。 Express the integer part of the product in binary.
用二进制表示乘积的整数部分。 You can (and should) collapse the two steps, so that you end up multiplying (601 - 2^9) * 2^14.
您可以(并且应该)折叠这两个步骤,以便最终乘以(601-2 ^ 9)* 2 ^ 14。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.