/-INFINITY and NaN

Andrew Koenig ark at alice.UucP
Sat Dec 28 02:30:19 AEST 1985


> Sun Unix uses IEEE float.  They provide library routines isnan() and isinf().
> Note that there are two infinite values (positive and negative) and many
> NaNs, so a simple compare to a single value is not good enough.

> These library routines seem to be a good idea, since they can be implemented
> for all kinds of float (eg, Vax, IBM) and increase portability.  (A system
> without infinites or NaNs would always return false of course.)

One does have to be a tiny bit careful on architectures where an attempt
to, say, pass a NaN to a subroutine causes a trap.



More information about the Comp.lang.c mailing list