Calculation returning NaN

Graham Wheeler gram at uctcs.uucp
Fri Feb 1 20:58:16 AEST 1991


Some C compilers have a special representation for infinity. This can lead
to results being shown as `Inf'. `NaN' (Not a Number) usually occurs as the
result of attempting undefined calculations on infinite quantities, such as
attempting to divide infinity by infinity, subtraction of Inf from Inf, and
even multiplying Inf by zero. Obviously, as NaN is a result, not an error
message, there is a representation for it as well.

Check your compiler documentation, particularly what data representations
are being used, to find out the precise conditions under which this occurs.
Graham Wheeler		      |	"Don't bother me, I'm reading a `Crisis'!"
Data Network Architectures Lab| Internet: <gram at uctcs.uct.ac.za>
Dept. of Computer Science     | Fidonet: <gram.uctcs at f4.n494.z5.fidonet.org>
University of Cape Town       |     BANG: <...uunet!ddsw1!olsa99!uctcs!gram>



More information about the Comp.lang.c mailing list