I am using an TMS320F2837xS cpu (C28x DSP core + FPU + CLA). I am trying to test floats for nan using isnan(). The macro implementation for this in math.h (compiler version 6.2.5 and 6.4.9) is defined as: isnan(x) ((x) != (x)). This is technically correct for nan's but it fails the test in the compiled code. I have looked at the assembly code that this produces and the code executes a CMPF32. In the instruction set manual (sprueo2b.pdf) the description for this instruction states that "NaN will be treated as infinity". If I change my code to test the float using isinf() then the test is true for a nan, but the definition for isinf() in math.h is comparing the float against +-INFINITY and INFINITY and NaN definitions differ in a binary sense. Is this the expected behavior? If this is the case why is the definition in math.h invalid?