Re: Is infinity equal to infinity?

John Mitchell <john_mitchell@intuit.com>
10 Jul 1998 21:01:31 -0400

          From comp.compilers

Related articles
Is infinity equal to infinity? erikr@iar.se (Erik Runeson) (1998-07-08)
Re: Is infinity equal to infinity? vosse@RULS41.FSW.LEIDENUNIV.NL (1998-07-10)
Re: Is infinity equal to infinity? rwhutch@nr.infi.net (1998-07-10)
Re: Is infinity equal to infinity? fis@mpi-sb.mpg.de (Matthias Fischmann) (1998-07-10)
Re: Is infinity equal to infinity? john_mitchell@intuit.com (John Mitchell) (1998-07-10)
Re: Is infinity equal to infinity? joachim.durchholz@munich.netsurf.de (Joachim Durchholz) (1998-07-10)
Re: Is infinity equal to infinity? bear@sonic.net (Ray Dillinger) (1998-07-11)
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)
[8 later articles]
| List of all articles for this month |

From: John Mitchell <john_mitchell@intuit.com>
Newsgroups: sci.math.num-analysis,comp.lang.c,sci.math,comp.compilers
Date: 10 Jul 1998 21:01:31 -0400
Organization: Intuit Inc.
Distribution: inet
References: 98-07-058
Keywords: arithmetic

Erik Runeson wrote:


> When comparing floating-point numbers, should infinity (Inf) be
> concidered equal to infinity?


Inf is meant to represent "positive infinity" in a way that would be
most useful in practical computations. NaN is a bit sequence which
does not represent any type of number at all. So it makes (practical)
sense to say that "x == NaN" should be false (because "==" is a
numerical comparison). This is a bit like asking "is the alphabet
blue?". Since the alphabet is "NaC" (not a colored object), we would
answer "no" (or perhaps, "what a ridiculous question!").


The result Inf - Inf = NaN also makes sense (for practical purposes),
since the difference between two large numbers may be big or small,
and the difference between consecutive terms of two sequences which
diverge (to +infinity) may converge to a finite value, diverge to
infinity, or not converge at all.


On the other hand, results like "Inf + Inf = Inf" and "Inf == Inf is
true" do have sensible interpretations when applied to large numbers
or divergent sequences, so it's reasonable to incorporate these into
the implementation of Inf (are you sure the IEEE standard doesn't say
that Inf == Inf is true? I though it did).


John Mitchell
San Diego, California
--


Post a followup to this message

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