This function is now part of the C++11 standard.
# DEAL_II_WITH_CXX17
#
# DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE
-# DEAL_II_HAVE_ISFINITE
# DEAL_II_HAVE_FP_EXCEPTIONS
# DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
#
"
DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE)
-CHECK_CXX_SOURCE_COMPILES(
- "
- #include <cmath>
- int main(){ double d=0; std::isfinite (d); return 0; }
- "
- DEAL_II_HAVE_ISFINITE)
-
#
# Check that we can use feenableexcept through the C++11 header file cfenv:
*/
#cmakedefine DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE
-#cmakedefine DEAL_II_HAVE_ISFINITE
#cmakedefine DEAL_II_HAVE_FP_EXCEPTIONS
#cmakedefine DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
#cmakedefine DEAL_II_FALLTHROUGH @DEAL_II_FALLTHROUGH@
inline bool is_finite (const double x)
{
-#ifdef DEAL_II_HAVE_ISFINITE
- return !std::isnan(x) && std::isfinite (x);
-#else
- // Check against infinities. Note
- // that if x is a NaN, then both
- // comparisons will be false
- return ((x >= -std::numeric_limits<double>::max())
- &&
- (x <= std::numeric_limits<double>::max()));
-#endif
+ return std::isfinite(x);
}
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams