C 将0.125转换为7位浮点格式

C 将0.125转换为7位浮点格式,c,floating-point,C,Floating Point,要转换的数字为-0.125 这是我的尝试 转换成二进制形式 Suppose we have a 7-bit computer that uses IEEE floating-point arithmetic where a floating point number has 1 sign bit, 3 exponent bits, and 3 fraction bits. All of the bits in the hardware work properly. Recall t

要转换的数字为
-0.125

这是我的尝试

转换成二进制形式

   Suppose we have a 7-bit computer that uses IEEE floating-point arithmetic where a 
floating point number has 1 sign bit, 3 exponent bits, and 3 fraction bits. All of the bits in 
the hardware work properly. 

Recall that denormalized numbers will have an exponent of 000, and the bias for a 3-bit 
exponent is 3.
移动小数

0.001
所以E=-3,因为我们把小数点右移了3次

0001.0 
所以 e=0 M=0? 这给了我

E = e -bias 
-3 = e -3
这是错误的。正确答案应该是
1000 100


我做错了什么

偏差为3,因此
1.0
的指数存储为3。因此,要得到1/8,您需要存储零,但这是非规范数的表示形式。非规范数必须明确存储前导位,以便尾数变为
100
而不是
000
。需要存储
1
会导致精度下降,这是非规范化的症状。

从十进制格式转换。移动基数点。这不是我要说的吗?只是术语。有一种叫做十进制FP的东西,所以如果你用十进制术语来指代二进制数,它会让人困惑。
1 000 000