Use the GCC built-in __builtin_isnanl (if it works).