Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: Calculation returning NaN Keywords: NaN Message-ID: <571@taumet.com> Date: 29 Jan 91 16:12:12 GMT References: Distribution: usa Organization: Taumetric Corporation, San Diego Lines: 22 fineberg@caip.rutgers.edu (Adam B. Fineberg) writes: >I was wondering if someone could point me to a source of information >about the math error NaN (Not-a-Number). This is a feature of IEEE floating-point, and can be found in ANSI/IEEE Std 754-1985, "IEEE Standard for Binary Floating-Point Arithmetic". In addition, the manuals for floating-point chips which implement IEEE arithmetic (such as Motorola 68881/2 and Intel 80x87) will contain a discussion of NaN. Briefly, an operation with an undefined result produces a NaN. The result of 0/0 or Infinity*0 is not defined, for example. Almost any operation involving a NaN, including comparison, results in a NaN, so that nonsense does not later turn into something which looks reasonable. The NaN result lets you know that something went wrong earlier in the calculation. NaN's are also used as the starting value of uninitialized variables. -- Steve Clamage, TauMetric Corp, steve@taumet.com