Not A Number in IEEE Math

Rajiv Sarathy sarathy at gpu.utcs.utoronto.ca
Tue Feb 20 04:25:58 AEST 1990


In article <44 at newave.UUCP> john at newave.UUCP (John A. Weeks III) writes:
>
>My understanding of the NaN (not a number) value in IEEE math is
>that once you get NaN, the operators +, -, /, *, and = are supposed
>to propagate the NaN value.  Is my understanding correct?
>
>Well, while using MetaWare's HIGH-C compiler for the 80386 chip, I
>have discovered that:
>
>			NaN / NaN = 1.0
>
>			      and
>
>			0.0 * NaN = 0.0.
>
>Is this correct behavior?  I think HIGH-C is broken...

As long as only very, VERY, large numbers (positive or negative) are defined
to be NaNs (ie. not results of division by zero, and other silly things), then
the above behaviour makes sense.

	Mathematically:

		lim    __n__ = 1.0	and     lim   0.0 * n = 0.0
	       n->inf    n		       n->inf

	where inf is +/- infinity.

Unfortunately, NaNs encompass other floating-point exceptions as well, on some
machines.

-- 

 Rajiv Partha Sarathy  	      _  _ /^\    INTERNET sarathy at gpu.utcs.utoronto.ca
 ................ooooooooOOOO(_)(_)\_/      BITNET sarathy at utorgpu.bitnet
 University Of Toronto Computing Services     UUCP sarathy at utgpu.uucp



More information about the Comp.lang.c mailing list