Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!world!iecc!compilers-sender From: henry@zoo.toronto.edu (Henry Spencer) Newsgroups: comp.compilers Subject: Re: Optimizing IEEE Floating-Point Operations Keywords: arithmetic, Fortran Message-ID: <91-06-023@comp.compilers> Date: 17 Jun 91 18:18:47 GMT References: <91-06-011@comp.compilers> <91-06-016@comp.compilers> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: henry@zoo.toronto.edu (Henry Spencer) Organization: U of Toronto Zoology Lines: 37 Approved: compilers@iecc.cambridge.ma.us In article <91-06-016@comp.compilers> bill@hcx2.SSD.CSD.HARRIS.COM (Bill Leonard) writes: >As far as I know, there is only _one_ kind of mathematics... Sorry, that view has been obsolete for a century, ever since non-Euclidean geometry started being taken seriously. You choose whichever mathematical system is suited to the problems you want to tackle. It is not at all difficult to find extended versions of the real numbers which feature things like infinities as part of the number system. In fact, if you start looking at the extended-real-number systems used in things like non-standard analysis, you find "numbers" much stranger than anything in IEEE arithmetic. >... NaNs and INFs represent a failure of the machine model to >adequately represent the _mathematical_ result (i.e., the result you would >get with infinite precision)... Um, what *is* the "mathematical result" of, say, 1/0? Even in high-school mathematics, that's illegal, i.e. NaN. In mathematical systems like the one underlying IEEE arithmetic, it is +infinity. There is no approximation involved; either one is an exact, mathematically correct result that would not be affected in any way by use of infinite precision. Which is right, and whether NaN is a representable value or simply results in an immediate failure, depends on the number system in use. It is important to realize that IEEE arithmetic is based on a slightly more sophisticated view of the numerical world than that taught in high school, and its implications cannot be understood in terms of high-school mathematics. It is also important to realize that you *cannot* reconcile the FORTRAN standard with the IEEE arithmetic standard just by reading between the lines intensively. Actual changes to FORTRAN would probably be needed to make it consistent with IEEE arithmetic. -- Henry Spencer @ U of Toronto Zoology, henry@zoo.toronto.edu utzoo!henry -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.