20 Jul 1998 16:54:48 -0400

Related articles |
---|

[5 earlier articles] |

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) |

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) |

[1 later articles] |

From: | Erik Runeson <erikr@iar.se> |

Newsgroups: | sci.math.num-analysis,comp.lang.c,sci.math,comp.compilers |

Date: | 20 Jul 1998 16:54:48 -0400 |

Organization: | IAR Systems AB |

Distribution: | inet |

References: | 98-07-058 98-07-114 |

Keywords: | arithmetic |

Henry Spencer wrote:

*> Actually it does, but careful reading is needed. A good resource for*

*> interpretation of IEEE 754 is David Goldberg's paper "What Every Computer*

*> Scientist Should Know About Floating-Point Arithmetic", in the March 1991*

*> issue of ACM Computing Surveys.*

*> So, what about Inf:Inf (that is, infinity compared to infinity)? The*

*> paper explains this, as per the standard's terse wording, as the limit of*

*> f(x):g(x), as x approaches some limit that makes both f(x) and g(x) go to*

*> infinity. Just what is the limit of f(x):g(x)? Depending on what f(x)*

*> and g(x) are, it could be "less than", "equal", or "greater than". So*

*> there is no single limit... and that means the result of Inf:Inf must be*

*> "unordered".*

*> ...*

*>*

*> And the table on page 13 of the standard specifies that the .EQ. predicate*

*> (one of the first six, which according to 5.7 are the ones that map into*

*> the traditional six predicates of programming languages) yields false,*

*> and does not cause an exception, for a comparison result of "unordered".*

*> So (Inf==Inf) is false.*

*>*

*> Sigh, I doubt that many compiler writers or silicon builders have gotten*

*> this right... It's awfully subtle.*

I have, since first posting this question discussed the issue with both

David Goldberg and William Kahan (known as the father of floating

point). They both agree that the comparison Inf=Inf should be true

according to the IEEE 754 standard. Goldberg wrote:

"If you have a copy of the IEEE standard, you will see that Inf == Inf.

The only time that you can get 'unordered' is if one of the operands is

NaN."

Myself, I don't find this at all obvious (I suppose this goes for many

of us...), but Kahan had more arguments:

"(...) +Infinity == +Infinity has to be true because +Infinity is the

coordinate of a point on a model of the real numbers. This means that

the logical equivalence of " x == y " and " x-y == 0 " is valid only

if at least one of x and y is a finite real number."

/Erik Runeson

----------------------------------------------------------------------

Erik Runeson

Email: erikr@iar.se (work, summer -98)

d95err@csd.uu.se (home and education)

Cellphone: +46 708 723597

--

Post a followup to this message

Return to the
comp.compilers page.

Search the
comp.compilers archives again.