I looked about around and found comments in some source code that according
to IEEE 754 apparently the result of converting a NAN to an integer is
unspecified.
I wrote a small test program that casts a double NAN into unsigned int.
On Linux/i386 + GNU libc the result is zero. An equivalent program
running under IRIX returns MAXINT, that's 2^31 - 1.
Since even making the aliens land on earth would be a strictly IEEE 754
conformant result or maybe somewhat closer to the reality, treating the
conversion operation as a nop therefore probably resulting in a random
result, I think the part of Mozilla which dies is buggy and should be fixed.
Ralf
|