This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to test for NaN

This always tests true when optimized.  Any ideas?

 

unsigned NaNtest;

memcpy(&NaNtest, &floatValue, sizeof(NaNtest));

NaNtest &= 0x7fc00000;

if (NaNtest == 0x7fc00000)

{

// always executes this code...

}