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

# Re: infinity != infinity

*From*: Ulrich Weigand <weigand at i1 dot informatik dot uni-erlangen dot de>
*To*: joern dot rennecke at superh dot com, amylaar at spamcop dot net
*Cc*: schwab at suse dot de, gcc at gcc dot gnu dot org
*Date*: Sat, 10 Jul 2004 03:26:34 +0200 (CEST)
*Subject*: Re: infinity != infinity

Joern Rennecke wrote:
>I know that there are a number of processors that have this behaviour,
>but that is not the point. The issue is what the standard actually says.
The standard is apparently less than explicit on this particular point.
But e.g. http://compilers.iecc.com/comparch/article/98-07-108
says the intent was that infinity was supposed to compare equal with
itself:
> To remove doubt as to the intent: In an implementation guide to a draft
> version of the standard, Coonen [_Computer_, 13: 1, p. 78] gives a table
> which clearly shows that +oo = +oo and -oo = -oo are to be TRUE.
and
> The standard states that
> Infinity arithmetic shall be construed as the limiting case of real
> arithmetic with operands of arbitrarily large magnitude, when such a
> limit exists. Infinities shall be interpreted in the affine sense, that is,
> -oo < (every finite number) < +oo.
> This *seems* to make it clear that the infinities of the standard represent
> the two improper elements of the extended real number system. And
> although many mathematicians may warn that +oo is not actually a
> number, they should still agree that +oo = +oo is TRUE in the extended
> real number system.
The current draft of the upcoming revision to 754 makes the latter point
more explicit:
"The mathematical standard underpinning the arithmetic in this standard
is the extended reals [...]."
Now there are apparently other opinions as well as to how to interpret
the standard on this point, and I'm not sure who has the definite answer.
But why should we now deviate from existing behaviour in hardware
implementations (and GCC implementation up to now)?
Bye,
Ulrich
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de