IEEE 754:哪里可以看到"the rounded result is within 0.5 ULP of the mathematically exact result"蕴涵?

IEEE 754: Where "the rounded result is within 0.5 ULP of the mathematically exact result" implication can be seen?

来自 ULP Wikipedia's page(强调已添加):

The IEEE 754 specification—followed by all modern floating-point hardware—requires that the result of an elementary arithmetic operation (addition, subtraction, multiplication, division, and square root since 1985, and FMA since 2008) be correctly rounded, which implies that in rounding to nearest, the rounded result is within 0.5 ULP of the mathematically exact result, using John Harrison's definition;

问:上面强调的含义具体在哪里可以看出?

... that in rounding to nearest, the rounded result is within 0.5 ULP of the mathematically exact result, using John Harrison's definition;

Where exactly the implication emphasized above can be seen?

接近 2 的幂。 (或任何基础)

考虑使用 ULP 作为 vs.

在 2 的幂为 p 及其最少编码的 FP 数字为 u 的邻域中,可表示的浮点值是 [p-u, p-u/2, p , p+u, p+2u] 对于基数为 2 的系统。

使用 quantum,这 5 个值的 ULP 是 [u/2,u/2,u,u,u]。

如果某些数学运算的确切答案恰好是p,那么p“0.5 ULP以内”包括[p-u/2, p],从而允许次等p-u/2 作为可接受的答案。

对于 John Harrison,这 5 个值的 ULP 是 [u/2、u/2、u/2、u、u]。

作为 2 的幂的值 p 的 ULP 是量子的 一半,因此只有 p 是可接受的回答。


参考:Unit in the Last Place - ULP