Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!uunet!mcsun!ukc!acorn!armltd!dseal From: dseal (David Seal) Newsgroups: comp.arch Subject: Re: IEEE arithmetic (Goldberg paper) Message-ID: <196@armltd.uucp> Date: 13 Jun 91 16:22:09 GMT References: <1991Jun11.175639.22558@zoo.toronto.edu> Sender: dseal@armltd.uucp Distribution: comp Organization: A.R.M. Ltd, Swaffham Bulbeck, Cambs, UK Lines: 64 In article <1991Jun11.175639.22558@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes: >In article <192@armltd.uucp> dseal (David Seal) writes: >>>Who knows whether IEEE infinity is a "mathematically defined result"? If you >> >>I would think it isn't: it doesn't correspond to a single mathematical real >>number in the way that ordinary IEEE numbers do. > >Why do you insist that the standard real numbers be the mathematical system >used? Number systems which include infinities are neither novel nor somehow >illegitimate. The real question about FORTRAN vs IEEE is how precise the >FORTRAN standard is about the nature of the number system it is running on. >Given that FP systems containing infinities are *not* new -- IEEE did not >invent this idea -- I would be surprised if a careful reading of the >standard mandated pure mathematical reals. > >(The real answer, of course, is that the FORTRAN standard was too early >to even consider IEEE FP, and attempts to determine the interaction of the >two by reading between the lines are a bit silly.) A fair point, and I agree it's open to interpretation. I would favour (*not* "insist on") the 'subset of the unextended real numbers' interpretation because (a) the unextended real numbers are a mathematical system which is *comparatively* easy to work with; (b) in the absence of any clues to the contrary, I would expect the Fortran standard to mean either 'using whatever number system is most appropriate on your machine' or 'using a system based on the unextended real numbers'. There seems to be a reasonable chance of writing reasonably portable Fortran code for the latter, despite the problems in establishing e.g. how big rounding errors can be and what the limits of the exponent range are. There are more major portability problems with using whatever number system you like - in particular, this whole thread was started by such problems with NaNs and infinities! As a major reason for having language standards is to promote portability, allowing a completely free choice of number system seems a bit awkward. In any case, the main point of my previous posting is that *if* you interpret the Fortran standard as insisting on the 'subset of the unextended real numbers' interpretation, you can achieve the required effect inside an IEEE system. Furthermore, statements like "0.0 * X = 0.0" are unconditionally true in such a system, so they can be used safely by optimisers. You are of course free to interpret the Fortran standard in other ways. (I should probably have been a bit less dogmatic in talking about "strict" compliance with the standard.) But if you use the full IEEE model, you then have to solve quite a few problems: e.g. how does the programmer detect the use of an infinity/NaN; how do you achieve a reasonable level of optimisation without breaking the IEEE standard; how do you make code written for your system portable to systems without IEEE arithmetic, etc.? To sum up: I suggested a way to have your Fortran adhere to the Fortran standard and your arithmetic to the IEEE standard, in a portable fashion. As a result, I don't see any evidence that the IEEE committee ignored existing language standards. There may well be other ways of achieving the same effect which additionally give you more complete access to the facilities of an IEEE arithmetic system, but IMHO they are all likely to be more complex and to require more understanding by the programmer. David Seal Sorry about the bad "From" line. This is on a list of things to be fixed here. Correct email address is "dseal@armltd.co.uk". All opinions are mine only...