[英]Converting Decimal to Single-Precision IEEE 754
(-128.4875) base 10 to Single-Precision IEEE 754 (-128.4875)以10为基础的单精度IEEE 754
Converting (128.4875) base 10 to BINARY is: 1000 0000 . 将(128.4875)以10为基数的二进制转换为: 1000 0000。 0111 1100 1100 1100 1100...
0111 1100 1100 1100 1100 ...
The SCIENTIFIC NOTATION of the binary is: 1 . 二进制的科学符号是: 1。 0000 0000 1111 1001 1001 1001... x 2^7
0000 0000 1111 1001 1001 1001 ... x 2 ^ 7
The SIGN BIT is: 1 (1 bit) SIGN BIT是: 1 (1位)
The MANTISSA is 0000 0000 1111 1001 1001 100 (23 bits) MANTISSA是0000 0000 1111 1001 1001 100 (23位)
The EXPONENT is 7 + 127 = (134) base 10 = 1000 0110 (8 bits) 指数为7 + 127 =(134)以10为基数= 1000 0110 (8位)
Checking my answer against an online converter: 根据在线转换器检查我的答案:
http://s17.postimg.org/3pkw9glm7/mantissa.png
(not enough reputation to post in-line images)
I got everything BUT the last digit of the mantissa. 我得到了所有内容,但尾数的最后一位。 What I did was I chopped off the first 23 digits after the point in the scientific notation.
我所做的是我将科学计数法中的该点后的前23位数字砍掉了。
I got a 0 where the converter got a 1. Why is this so? 我得到0,转换器得到1。为什么会这样?
Do not “chop” the bits. 不要“砍”位。 Round the bits being removed:
舍入要删除的位:
Thus: 从而:
(This is “round to nearest, ties to even”.) (这是“舍入到最接近,联系成偶”。)
Also, there is no mantissa in a floating-point number. 另外,浮点数中没有尾数。 The fraction portion is the significand.
分数部分是有效位数。 (A mantissa is logarithmic. A significand is linear.)
(尾数是对数的。有效位数是线性的。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.