It is well-known that NaNs propagate in arithmetic, but I couldn\'t find any demonstrations, so I wrote a small test:
#include #include
The default floating point handling in Intel C++ compiler is /fp:fast, which handles NaN's unsafely (which also results in NaN == NaN being true for example). Try specifying /fp:strict or /fp:precise and see if that helps.
/fp:fast
NaN
NaN == NaN
true
/fp:strict
/fp:precise