Mircosoft C V5.1 floating point problem.

Stephen Clamage steve at taumet.com
Fri Aug 10 01:57:53 AEST 1990


NaN (not-a-number) is a well-defined concept in IEEE floating-point.
Some arithmetic operations are undefined, such as
	0.0 / 0.0
	Infinity * 0.0
	Infinity / Infinity
Since no number can be the result of such an operation, NaN is the result.
NaN and +/- Infinity each have a special bit pattern which is reserved
for that use, and cannot be the result of any valid numerical operation.
Infinity is usually the result of an overflow.  Dividing by Infinity
always results in zero (except for Infinity and NaN).  The result of
any operation involving a NaN is a NaN.  That is, Infinities and NaNs
propogate so that an expression which fails at some point during its
evaluation doesn't suddenly wind up with an ordinary numerical value.

So you may have some calculation which overflows, or otherwise has an
invalid operation, possibly in an intermediate result.  Floating-point
expressions are not always evaluated in the order in which you expect,
and intermediate overflows are possible.
-- 

Steve Clamage, TauMetric Corp, steve at taumet.com



More information about the Comp.lang.c mailing list