Just as an interesting info, after reading this thread and another, related to it (sorry for no timings,
Gunther, my system is 32 bit, as you know), I thought about another way to test validity of float/double. This method "derived" from this my code
http://masm32.com/board/index.php?topic=2242.msg23112#msg23112Now some info and then what I've found.
CMPPS and CMPPD instructions in the equality comparsion mode (the immediate byte is 0) have the specification that they return false as a result of comparsion of the numbers where operand is NaN. No exceptions are raised also.
But now, if we compare the number with raw hex value as 0x7FF0000000000000 with itself, we get TRUE result. But the number is NaN, so there is "bug" in this SSE instruction? The same if the number is 0x7F80000000000000 (infinity) - the result is wrong.
If we compare the number, for an instance, 0x7FF0000000000001 with itself, then instruction works OK and returns true. But is there reason why it returns not proper result for 0x7FF0000000000000?
If not that bug, is it such or not, it would have possible to use these pieces as a check for finity.
Check float for finity:
cmpps xmm0,xmm0,0
movd eax,xmm0
ret
Check double for finity:
cmppd xmm0,xmm0,0
movd eax,xmm0
ret