Pike does not have its own implementations of the basic floating point operations (addition, multiplication, comparison, etc), so the C environment must provide such implementations with correct handling of NaN. For comparison, Pike can use the functions isless() instead of < if it exists. For equality, there actually seems to be some extra code that looks for NaN, but it looks broken:
case T_FLOAT: if (PIKE_ISNAN(a->u.float_number) != PIKE_ISNAN(b->u.float_number)) { return 0; } return a->u.float_number == b->u.float_number;
That should be ||, not !=. An even better solution would be to use isunordered() if it exists. I'll update the code.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2004-01-12 12:48: Subject: icc & nan
My icc (7.1) bugs in comparison of NaN. But Pike has it's own support of NaN, doesn't it?
Is there any simple way of turning on that support, so I can write a configure test to turn off using a native NaN if it doesn't work?
/ Mirar