This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

infinity != infinity


Your test execute/ieee/compare-fp-1.c says:

  iungt (pinf, pinf, 0);
  iungt (ninf, ninf, 0);

However, as I interpret ieee 754, +inf compares unorderd to +inf,
and likewise -inf compares unordered to -inf.

6.1 Says that that infinity arithmetic shall be construed as the limiting
case of real aritmetic of arbitrary large magnitude, where such a limit
exists.
Since both sides of the comparison are typically computed independently,
such a limit only exists if you could apply the limit operations
independently in either order, or simultanously, and get the same result.
However,

compare(+infinity, n)
lim n
0 -> +infinity

is greater, while

compare(n, +infinity)
lim n
0 -> +infinity

is less,

compare(n, n)
lim n
0 -> +infinity

is equal, and

compare(3 * n, (3 * n) XOR 1)
lim n
0 -> +infinity

does not even converge.

Likewide for compare (-infinity,-infinity).

Thus, two infinities with the same sign should compare unordered.
This is also consistent with their difference being a NaN.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]