Defining IEEE NaN and Inf at compile time

Jonathan Sweedler validgh!sun!mipos2.intel.com!jsweedleaSun.COM
Wed Dec 19 08:37:52 PST 1990


| There are also single-precision and (coming soon) long double-precision
| versions of the following functions, all with corresponding Fortran interfaces
| too.  Note that signaling_nan() never worked in our Sun-386i implementation
| because there's no way to force a signaling NaN into an 80387 data register.

This is only true if you try to load a single or double precision SNaN into
a register.  This is because FLD of a single or double precision number is
defined to be a conversion to extended precision.  Thus, FLD single/double
is an "arith-type" instruction that catches exceptions.  However, FLD of an
extended precision number is a "move-type" instruction and has no arithmetic
exceptions.  Thus, an extended precision SNaN may be loaded into a register
with no problem.

Of course, I understand your point that it is impossible to use the
signaling_nan() function on the '387 as you have defined it.  But, if
it had an extended precision counterpart, then it would have worked.

jon



More information about the Numeric-interest mailing list