课程:Scientific Computing
习题:Chapter 1,1.20 What is the IEEE single-precision binary floating-point representation of the decimal fraction 0.1
(a) with chopping?
(b) with rounding to nearest?
问题:向偶舍入
概念:书本P19, Round to nearest: fl(x) is the nearest floating-point number to x; in case of a tie, we use the floating-point number whose last stored digit is even. Because of the latter property, this rule is also sometimes called round to even.
资料:
1、《深入理解计算机系统(CSAPP)》
深入理解计算机系统(第二版)||http://pan.baidu.com/s/1i3KOnel
P75
2、《What Every Computer Scientist Should Know About Floating-Point Arithmetic》
浮点数结构详解||http://pan.baidu.com/s/1o6ICjZc
定理5
文章还提供了IEEE等更多相关内容
3、其他搜索资料
计算机系统原理(2.8)---浮点数的舍入,Java中的舍入例子以及浮点数运算||http://tech.ddvip.com/2013-10/1382982036204947.html
计算机舍入问题||http://blog.csdn.net/revilwang/article/details/7649509
补充:对于V = 0.yyyyy··· 的无穷二进制位(其中 y 是一个 k 位的序列,例如 1/3 = 0.01010101···,y = 01,k = 2),满足以下公式:
V = Y / (2^k - 1)
推导:V 左移 k 为为 y.yyyy···,也即 Y + V = V * 2^k,变换一下就可以得到公式。
用这种方法可以快速计算出某些二进制位代表的十进制数,比如 0.001001001··· = 1 / (2^3 - 1) = 1 / 7,0.000111000111000111··· = 7 / (2^6 - 1) = 7 / 63 = 1 / 9