I believe you can compare directly using the macros INF and -INF (e.g., "if (f == INF)").
I don't know of instances where the Dynamic C floating point library will use a NaN value other than INF or -INF.
Can you post an example of what you're trying to test for, and how the test is failing?