为什么 +0.0 > -0.0 不适用于 IEEE754 浮点数?

Why does +0.0 > -0.0 not hold for IEEE754 floats?

IEEE754浮点数有一个signed zero的概念,即-0.0+0.0有两种不同的位模式,可以理解为单边限制: ±0 := limδ→0 ±δ。该标准提供这些数字是为了与(带符号的)无穷大 +Inf-Inf1./±0. 给出 ±Inf)保持一致,并且有一些证据表明它有助于减少舍入误差。

从极限可以清楚地看出,虽然它们是不同的实体,但它们 比较为相同的值,即 +0.0 == -0.0 成立。然而,从极限我也认为下面的东西应该成立:+0.0 > -0.0,因为它适用于任何小的 δ。然而,这是不正确的。由于此 属性 偶尔会有用(例如,考虑区分两个零),标准委员会选择不这样做是否有令人信服的理由?

Mathworld's article on the number system underlying floating-point arithmetic cites David Goldberg's famous paper,也就是说,

Although distinguishing between +0 and -0 has advantages, it can occasionally be confusing. For example, signed zero destroys the relation x = y ⇔ 1/x = 1/y, which is false when x = +0 and y = -0. However, the IEEE committee decided that the advantages of utilizing the sign of zero outweighed the disadvantages.

委员会有一个 website which can be searched 用于此类讨论,看起来带符号的零是永久争议的根源。

我在那里找不到关于您的特定问题的任何信息。但只是作为一种猜测,他们可能想简化硬件,这种比较只会从集合{less,greater,equal,unordered}中产生一个结果。允许 –0 < +0 和 –0 = +0 会使某些电路复杂化(并可能减慢)。这可能被认为是不经济的。