I need to check a double value for infinity in a C++ app on Linux. On most platforms this works by comparing with std::numeric_limits<double>::infinity()
. However, on some old platforms (RedHat 9 for example, with gcc 3.2.2) this is not available, and std::numeric_limits<double>::has_infinity
is false there.
What workaround would you recommend for those platforms?
Ok, I have now resorted to using the INFINITY
and NAN
macros on that particular machine - seems to work fine. They come from math.h
.