I want to use isfinite
function in my C++ code.
This function is available in the default math.h
but not in the default version(-std=gnu++98) of cmath
.
So if I include math.h
and make sure cmath
is not included, then isfinite
is available.
If any of other header files, like valarray
includes cmath
, then isfinite
is gone.
C++11 in GCC 4.3 is experimental so I don't want to turn it on.
Is there a way to use C99 math.h
in C++98 code?
I found this related question on testing NaN, and the non-C++11 solutions seems very ugly.
EDIT
As is pointed by @old_mountain in the comment, when cmath
is used, isfinite
is still available but need to be called by std::isfinite
, using the std
namespace.