Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!netcom!teda!ditka!mcdchg!ddsw1!proxima!undeed!ucthpx!uctcs!gram From: gram@uctcs.uucp (Graham Wheeler) Newsgroups: comp.lang.c Subject: Re: Calculation returning NaN Keywords: NaN Message-ID: <1991Feb01.095816.14907@ucthpx.uct.ac.za> Date: 1 Feb 91 09:58:16 GMT References: Sender: news@ucthpx.uct.ac.za (UCT News Admin.) Reply-To: gram@staff.UUCP (Graham Wheeler) Distribution: usa Organization: Dept. of Computer Science, University of Cape Town Lines: 13 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: Dept. of Computer Science | Fidonet: University of Cape Town | BANG: <...uunet!ddsw1!olsa99!uctcs!gram>