从计算机系统:程序员的视角http://csapp.cs.cmu.edu
练习题 2.51
我们在习题 2.46 中看到爱国者导弹软件近似于 0.1,因为 x =
0.00011001100110011001100(binary).
相反,假设他们使用 IEEE 舍入到偶数模式来确定 x' 到 0.1 的近似值,二进制点右侧有 23 位。
A. x' 的二进制表示是什么?
from the solution at the back of book,
Looking at the nonterminating sequence for 1/10, we can see that the 2 bits to the right of the rounding position are 1, and so a better approximation to 1/10 would be obtained by incrementing x to get x′ = 0.00011001100110011001101, which is larger than 0.1.
B. x′ - 0.1 的近似十进制值是多少?
The solution says it's
We can see that x′ − 0.1 has binary representation: 0.0000000000000000000000000[1100]
Comparing this to the binary representation of 1 , we can see that it is 2^−22 × 0.1 , which is around 2.38 x 10^-8
我对(B)的问题是我们如何得到
x' - 0.1 == 0.0 0000 0000 0000 0000 0000 0000[1100] ?
我的计算给了我 0.000 0000 0000 0000 0000 0000 0100 (大约是解决方案所说的两倍)