From: David Wells Date: Thu, 10 Aug 2017 22:13:14 +0000 (-0400) Subject: Remove checks for various isnan functions. X-Git-Tag: v9.0.0-rc1~1300^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c855d00809a6e2b4510f6021c53d526303674a6e;p=dealii.git Remove checks for various isnan functions. This PR removes DEAL_II_HAVE_ISNAN DEAL_II_HAVE_STD_ISNAN DEAL_II_HAVE_UNDERSCORE_ISNAN in favor of using std::isnan, which is a C++11 function, instead. --- diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index d5e3b15e3c..d1dc5b7914 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -22,8 +22,6 @@ # DEAL_II_WITH_CXX17 # # DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE -# DEAL_II_HAVE_ISNAN -# DEAL_II_HAVE_UNDERSCORE_ISNAN # DEAL_II_HAVE_ISFINITE # DEAL_II_HAVE_FP_EXCEPTIONS # DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS @@ -497,30 +495,6 @@ CHECK_CXX_SOURCE_COMPILES( " DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE) -CHECK_CXX_SOURCE_COMPILES( - " - #include - int main(){ double d=0; std::isnan (d); return 0; } - " - DEAL_II_HAVE_STD_ISNAN) - - -CHECK_CXX_SOURCE_COMPILES( - " - #include - int main(){ double d=0; isnan (d); return 0; } - " - DEAL_II_HAVE_ISNAN) - - -CHECK_CXX_SOURCE_COMPILES( - " - #include - int main(){ double d=0; _isnan (d); return 0; } - " - DEAL_II_HAVE_UNDERSCORE_ISNAN) - - CHECK_CXX_SOURCE_COMPILES( " #include diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 609e390f8f..10b97ec829 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -108,9 +108,6 @@ */ #cmakedefine DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE -#cmakedefine DEAL_II_HAVE_ISNAN -#cmakedefine DEAL_II_HAVE_STD_ISNAN -#cmakedefine DEAL_II_HAVE_UNDERSCORE_ISNAN #cmakedefine DEAL_II_HAVE_ISFINITE #cmakedefine DEAL_II_HAVE_FP_EXCEPTIONS #cmakedefine DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS diff --git a/include/deal.II/base/numbers.h b/include/deal.II/base/numbers.h index 6e3782926b..ded2ddbdeb 100644 --- a/include/deal.II/base/numbers.h +++ b/include/deal.II/base/numbers.h @@ -141,8 +141,11 @@ namespace numbers * * If none of the functions detecting NaN is available, this function * returns false. + * + * @deprecated This function has been deprecated in favor of the C++11 + * function std::isnan. */ - bool is_nan (const double x); + bool is_nan (const double x) DEAL_II_DEPRECATED; /** * Return @p true if the given value is a finite floating point number, i.e. @@ -283,21 +286,13 @@ namespace numbers inline bool is_nan (const double x) { -#ifdef DEAL_II_HAVE_STD_ISNAN return std::isnan(x); -#elif defined(DEAL_II_HAVE_ISNAN) - return isnan(x); -#elif defined(DEAL_II_HAVE_UNDERSCORE_ISNAN) - return _isnan(x); -#else - return false; -#endif } inline bool is_finite (const double x) { #ifdef DEAL_II_HAVE_ISFINITE - return !is_nan(x) && std::isfinite (x); + return !std::isnan(x) && std::isfinite (x); #else // Check against infinities. Note // that if x is a NaN, then both diff --git a/include/deal.II/lac/solver_control.h b/include/deal.II/lac/solver_control.h index 71434fed6d..2156664839 100644 --- a/include/deal.II/lac/solver_control.h +++ b/include/deal.II/lac/solver_control.h @@ -176,11 +176,7 @@ public: * procedure. * * The iteration is also aborted if the residual becomes a denormalized - * value (@p NaN). Note, however, that this check is only performed if the - * @p isnan function is provided by the operating system, which is not - * always true. CMake checks this with the 'check_01_cxx_features.cmake' - * test and sets the flag @p DEAL_II_HAVE_ISNAN in the include file - * deal.II/base/config.h if this function was found. + * value (@p NaN). * * check() additionally preserves @p step and @p check_value. These * values are accessible by last_value() and last_step(). diff --git a/source/lac/solver_control.cc b/source/lac/solver_control.cc index ceb720cf70..d20d5fe552 100644 --- a/source/lac/solver_control.cc +++ b/source/lac/solver_control.cc @@ -93,7 +93,7 @@ SolverControl::check (const unsigned int step, } if ((step >= maxsteps) || - numbers::is_nan(check_value) || + std::isnan(check_value) || (check_failure && (check_value > failure_residual)) ) {