[G4] 2 + 2 = 4.000000001?

Doug McNutt douglist at macnauchtan.com
Thu Feb 26 18:04:28 PST 2004


At 02:23 +0100 2/27/04, Steven wrote:
>James Asherman wrote:
>>Mine says NaN  . I don't know what that means.
>Than means "Not a Number".

There are a bunch of them. NaN can be followed by an identifier.

You tried to divide by zero.
The result is too big meaning > 10^308
The result is too small meaning < 10^(-308)
The result is imaginary  (or complex)
The series didn't converge.
And some more (Google on "IEEE floating point").

It's possible to overflow floating point operations with integers if there are more than 15 digits somewhere in the intermediate calculation .

123456789012345 - 123456789012343 might produce the small error reported.

But the problems with binary representations more commonly come about when the input is a decimal fraction - like 1/10 - which cannot be expressed exactly in binary just as 1/3 cannot be expressed in decimal.
-- 
-->  There are 10 kinds of people:  those who understand binary, and those who don't <--



More information about the G4 mailing list