Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!world!iecc!compilers-sender From: cfarnum@valhalla.cs.wright.edu (Charles Farnum) Newsgroups: comp.compilers Subject: Optimizing IEEE Floating-Point Operations Keywords: Fortran, arithmetic Message-ID: <91-06-022@comp.compilers> Date: 17 Jun 91 13:30:03 GMT References: <91-06-016@comp.compilers> <91-06-011@comp.compilers> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: cfarnum@valhalla.cs.wright.edu (Charles Farnum) Organization: Compilers Central Lines: 44 Approved: compilers@iecc.cambridge.ma.us In article <91-06-016@comp.compilers>, bill@hcx2.SSD.CSD.HARRIS.COM (Bill Leonard) writes: ]In article <91-06-011@comp.compilers>, bron@sgi.com (Bron Campbell Nelson) writes: ]> ...For example, the Fortran standard clearly states that an expression ]> may be replaced by one that is "mathematically equivalent" but without ]> specifing just what kind of "mathematics." ... ]As far as I know, there is only _one_ kind of mathematics. The FORTRAN ]standard is referring to real mathematics, not any particular means of ]_approximating_ mathematics. There are many different mathematical systems. Some happen to have operators that are much easier to work with efficiently, or even effectively, than others. The IEEE standard is one such, and the best one available in the eyes of most of the people who study such things. Keep in mind that Kahan's contributions to the standard helped win a Turing Award. And Kahan is *not* an ivory-tower academic; he is most emphatically interested in the real use of computers for number crunching. ]Our compilers, I believe, would perform the transformation. As a general ]rule, we take the view that NaNs and INFs are exceptional conditions, ]rather than the norm. There may be applications where that view is ]incorrect, but so far we've not encountered them. There are many applications *in principle* where that view is incorrect. There are not many in practice because most computer scientists know very little about writing code that is robust in the presence of NaNs and INFs. This is primarily a problem of education, not of the difficulty of writing such code. I would steer clear of compilers that make such transformations; performing algebraic manipulations valid in one mathematical system for some computations to be performed in another mathematical system is dangerous. Although I agree that they agree with the F77 standard (which is ambiguous on the point, hardly avoidable given the different mathematical systems in common use on computers in 1977), they can break well-written (i.e., efficient, readable, and robust) code that makes use of the provisions of the IEEE standard. /charlie -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.