While writing some test cases, and some of the tests check for the result of a NaN.
I tried using std::isnan but the assert failes:
Asse
This looks like a bug in your library's implementation of isnan() to me. It works fine here on gcc 4.2.1 on Snow Leopard. However, what about trying this?
std::isnan(std::abs(yourNanVariable));
Obviously, I can't test it, since std::isnan(-NaN) is true on my system.
EDIT: With -ffast-math, irrespective of the -O switch, gcc 4.2.1 on Snow Leopard thinks that NAN == NAN is true, as is NAN == -NAN. This could potentially break code catastrophically. I'd advise leaving off -ffast-math or at least testing for identical results in builds using and not using it...