Re: Is infinity equal to infinity?

darcy@usul.CS.Berkeley.EDU (Joseph D. Darcy)
20 Jul 1998 17:00:00 -0400

          From comp.compilers

Related articles
[7 earlier articles]
Re: Is infinity equal to infinity? Kevin@quitt.net (1998-07-11)
Re: Is infinity equal to infinity? dwcantrell@aol.com (1998-07-13)
Re: Is infinity equal to infinity? dwcantrell@aol.com (1998-07-13)
Re: Is infinity equal to infinity? henry@spsystems.net (1998-07-13)
Re: Is infinity equal to infinity? erikr@iar.se (Erik Runeson) (1998-07-20)
Re: Is infinity equal to infinity? larry.jones@sdrc.com (Larry Jones) (1998-07-20)
Re: Is infinity equal to infinity? darcy@usul.CS.Berkeley.EDU (1998-07-20)
Re: Is infinity equal to infinity? darcy@usul.CS.Berkeley.EDU (1998-07-20)
Re: Is infinity equal to infinity? darcy@usul.CS.Berkeley.EDU (1998-07-20)
Re: Is infinity equal to infinity? joachim.durchholz@munich.netsurf.de (Joachim Durchholz) (1998-07-20)
Re: Is infinity equal to infinity? miker3@ix.netcom.com (1998-07-21)
Re: Is infinity equal to infinity? dwcantrell@aol.com (1998-07-24)
| List of all articles for this month |

From: darcy@usul.CS.Berkeley.EDU (Joseph D. Darcy)
Newsgroups: sci.math.num-analysis,sci.math,comp.compilers
Date: 20 Jul 1998 17:00:00 -0400
Organization: University of California, Berkeley
Distribution: inet
References: 98-07-058 98-07-090
Keywords: arithmetic

Joachim Durchholz <joachim.durchholz@munich.netsurf.de> writes:


>Erik Runeson wrote:
>>
>> When comparing floating-point numbers, should infinity (Inf) be
>> concidered equal to infinity?
>>
>> Inf == Inf ?


>>The IEEE 754 standard for floating-point arithmetics does not say
>>anything about this case, but a similar case is:


The IEEE 754 standard does implicitly define Infinity == Infinity to
be true. The relevant part of the standard is section 5.7: "Four
mutually exclusive relations are possible [between two IEEE 754
values]: less than, equal, greater than, and unordered. The last case
arises when at least one operand is NaN." Between any pair of
floating point values exactly one of these four relations is true.
Therefore, since Infinity is not NaN, Infinity is not unordered with
respect to itself. Having one of (Infinity < Infinity) and (Infinity
> Infinity) be true wouldn't be consistent, so (Infinity == Infinity).


[equality of infinity to itself depends on affine/projective mode]


>For example, Intel x87 floating-point arithmetic has the following
>infinities:
> 1/0 positive infinity
> -1/0, log(0) negative infinity
>These may compare equal to each other or not, depending on the mode the
>chip is in: in "affine" mode, they are different, in "projective" mode,
>they are considered equal.


No, projective infinity on the 8087 is equal to itself.


In IEEE 754, there are two signed infinities with


-infinity < any finite value < +infinity.


Adding infinity to a real number system in this manner is called an
affine completion. There is also another way to add infinity to a
real number system called a projective completion. In a projective
completion there is a single unsigned infinity. Schematically, the
numbers in an affine completion are arranged in a line with
+/-infinity at the endpoints while in a projective completion the
numbers form a circle with infinity across from zero. Since a
projective infinity doesn't have a sign, comparing a floating point
value other than infinity to a projective infinity is unordered.
However, a projective infinity is equal to itself.


Depending on the computation, using affine or projective infinities
may be more convenient.


The floating point of the 8087, a precursor to and basis for IEEE 754,
has modes supporting both affine and projective infinity. The IEEE
754 committee chose to drop one infinity mode to simplify the
standard; the affine completion was chosen since it was judged to be
less strange. Further discussion of properties of various algebraic
completions of the real numbers can be found on page 23 of
http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf.


-Joe Darcy
darcy@cs.berkeley.edu
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.