Newsgroups: comp.arch
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!wuarchive!csus.edu!borland.com!sjc
From: sjc@borland.com (Steve Correll)
Subject: Re: IEEE floating point
Message-ID: <1991May24.221018.18582@borland.com>
Organization: Borland International
References: <9105240158.AA02761@ucbvax.Berkeley.EDU> <1991May24.161833.20530@riacs.edu>
Date: Fri, 24 May 1991 22:10:18 GMT

In article <1991May24.161833.20530@riacs.edu> lamaster@pioneer.arc.nasa.gov (Hugh LaMaster) writes:
>I am not aware of any additional design cost to compilers or other system
>software.

(I'm not the original complainant, but I do compilers.)

Pre-IEEE compilers generally require modification to conform to the letter of
the standard. Optimizers which rely on a family of axioms like the following:

  ! (a > b) implies a <= b

must be changed lest they produce incorrect code in the presence of NaN.

The existence of two representations for zero rules out certain code
optimizations.

What to do about NaN in Fortran arithmetic IF is a quandary when traps are
disabled. It's neither less than, nor equal to, nor greater than zero. The
obvious solution--fall through to the next statement--is likely to surprise
and not delight the average programmer.

At least one compiler vendor went to great lengths to obey IEEE rules when
folding constant expressions at compile time, warning the user whenever a
result was inexact, since the compiler could not know what the state of
inexact traps or rounding would be at execution time. The average programmer
may or may not appreciate a warning about every "1./10" in the code, but I'm
told it was an effective selling point in competition with other compilers.

>As for hardware, there has been a tremendous benefit to microprocessor
>based systems, from PC's to workstations, in having standard parts
>available which implement IEEE.  It means that both system designers
>and users have available high performance IEEE parts.

That's a good argument for _some_ standard, though not for IEEE in particular.
When you build an emulator or cross-compiler, it is much less work if the
host and target machines implement floating point identically.

>Does your System
>have a Weitek, TI, Cypress, or whatever, FP unit?  Do you know, or care?

Never underestimate entropy. Though Sun has pretty much standardized on IEEE,
their "f77" manual page lists the following options, several of which require
you to know who made your floating-point chip: -cg87, -cg89, -fnonstd, -f3167,
-f68881, -f80387, -ffpa, -ffpaplus, -fsoft, -fswitch, -fstore. :-)
