/usr/include/math.h
of OS X Mavericks says:
These inline functions may fail to return expected results if unsafe
math optimizations like those enabled by -ffast-math are turned on.
Thus, (somewhat surprisingly) you only get the fast inline
implementations if such compiler options are NOT enabled. This is
because the inline functions require the compiler to be adhering to
the standard in order to work properly; -ffast-math, among other
things, implies that NaNs don't happen, which allows the compiler to
optimize away checks like x != x, which might lead to things like
isnan(NaN) returning false.