Ludovic Courtès wrote: > On `alphaev56-dec-osf5.1b', NaN handling seems to be deeply broken. > Consider this piece of code: > > --8<---------------cut here---------------start------------->8--- > #include <math.h> > > extern unsigned int DQNAN[2]; > > int > main (int argc, char *argv[]) > { > return isnan (* (double *) DQNAN); > } > --8<---------------cut here---------------end--------------->8--- > > When compiled with GCC 4.0.2, it bails out with SIGFPE.
What's the result when you compile it with cc? $ cc foo.c -lm $ ./a.out $ echo $? What's the result for a program that uses a quiet NaN, computed differently? #include <math.h> double zero = 0.0; int main() { return isnan (zero / zero); }; And finally, what's the hexdump of that DQNAN constant? #include <math.h> #include <stdio.h> int main() { printf("%04X%04X\n", DQNAN[1], DQNAN[0]); return 0; } Bruno