Floating point relative error bounds, clarification needed
I'm reading David Goldberg's What Every Computer Scientist Should Know About Floating Point Arithmetic paper, and I'm confused by one of the inequalities (2):
(1/2)B^-p <= (1/2)ulp <= (B/2)B^-p
I follow the reasoning behind the left hand side and the right hand side, but not the middle. As I understand it, ULPs are basically what you get if you read the bits of two floats of the same sign as two ints and subtracted them. So the first layer of confusion is these inequalities don't have the same units, ULP vs just significand digits. But I'm guessing he means if we translated a ULP into a significand where we just had a 1 in the last place and divided that by 2. So then I thought about how to express that number in terms of B.
For a significand d.dd...dd
I would expect that a significand of 1 ulp is 0.00...01
(I'm using Goldberg's confusing digit notation here... even though those d's aren't subscripted they're distinct). Since p
is the number of digits in the significand, and we're looking to set the last digit to 1 (or B/2
in general), I'd expect:
1ulp = 1.00 * B^(-p+1)
The +1
being because the digit on the left hand side of the decimal counts as part of p. If I substitute that into the original inequality I get:
(1/2)B^-p <= (1/2)B^(-p+1) <= (B/2)B^-p
(1/2)B^-p <= (1/2)B^(-p+1) <= ((B*B^(-p))/2)
(1/2)B^-p <= (1/2)B^(-p+1) <= ((B^(-p+1))/2)
(1/2)B^-p <= (1/2)B^(-p+1) = (1/2)B^(-p+1)
And then the middle and the right hand side are always equal, which makes me think I'm doing something wrong. Any ideas?
链接地址: http://www.djcxy.com/p/85626.html上一篇: 更改浮点舍入模式
下一篇: 浮点相对误差范围,需要澄清