[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Floating point failure (NaN)
From: |
Ron Miller |
Subject: |
Floating point failure (NaN) |
Date: |
Mon, 4 Jun 2001 16:32:38 -0700 |
Hi,
I have spent a lot of the last week trying to track down a bug that appears
to be OS/hardware related.
The problem that I am seeing is that NaN (not a number) is mysteriously
appearing in some of my floating point variables even when it should not.
I posted a message last week, but since then I have simplified the code.
I have a code fragment that looks like the following:
double da, db;
while ( 1 ) {
da = 1.0;
db = da;
if ( (da!=da) || (db!=db) ) {
printf( "Found NaN\n" );
}
}
This will run for hours or even days on a multi-processor machine, and then
at the same time, several of the jobs will start printing out that they
found NaN (maybe 3 or 4 messages) and then go on acting normally again..
Some machines also seem more susceptible to the problem, although it seems
to eventually fail on all machines that I have tried.
My operating system / environment is:
Redhat 6.2
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
(also tried gcc version 2.95.2 19991024 (release))
2 x 700 MHz Intel Pentium III
100 MHz Bus Clock Speed
2 GB RAM
4 GB Swap Space
Changing compilers or changing compiler flags doesn't seem to fix the
problem.
It also fails with floats as well as doubles.
It seems like it might be a problem with the hardware (FPU overheating?),
but I have been able to get it to fail on machines from multiple vendors.
Has anyone else seen anything like this before?
Thanks,
Ron Miller
- Floating point failure (NaN),
Ron Miller <=