From: bangerth Date: Tue, 11 Sep 2012 13:31:52 +0000 (+0000) Subject: Assume that std::numeric_limits is available. This has been the case for a very long... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64eea3aa5b4c8e0b3b4679b4608b68176097fb8d;p=dealii-svn.git Assume that std::numeric_limits is available. This has been the case for a very long time already. git-svn-id: https://svn.dealii.org/trunk@26283 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/base/parameter_handler.cc b/deal.II/source/base/parameter_handler.cc index 1a628bfea4..1b40987948 100644 --- a/deal.II/source/base/parameter_handler.cc +++ b/deal.II/source/base/parameter_handler.cc @@ -29,10 +29,8 @@ #include #include #include +#include -#ifdef HAVE_STD_NUMERIC_LIMITS -# include -#endif #ifdef DEAL_II_MSVC // on Windows systems with MS Visual C/C++, there is a @@ -148,20 +146,8 @@ namespace Patterns - const int Integer::min_int_value = -#ifdef HAVE_STD_NUMERIC_LIMITS - std::numeric_limits::min(); -#else - 1; -#endif - - const int Integer::max_int_value = -#ifdef HAVE_STD_NUMERIC_LIMITS - std::numeric_limits::max(); -#else - 0; -#endif - + const int Integer::min_int_value = std::numeric_limits::min(); + const int Integer::max_int_value = std::numeric_limits::max(); const char* Integer::description_init = "[Integer"; @@ -259,19 +245,8 @@ namespace Patterns - const double Double::min_double_value = -#ifdef HAVE_STD_NUMERIC_LIMITS - -std::numeric_limits::max(); -#else - 1; -#endif - - const double Double::max_double_value = -#ifdef HAVE_STD_NUMERIC_LIMITS - std::numeric_limits::max(); -#else - 0; -#endif + const double Double::min_double_value = -std::numeric_limits::max(); + const double Double::max_double_value = std::numeric_limits::max(); const char* Double::description_init = "[Double"; @@ -455,13 +430,8 @@ namespace Patterns - const unsigned int List::max_int_value = -#ifdef HAVE_STD_NUMERIC_LIMITS - std::numeric_limits::max(); -#else - numbers::invalid_unsigned_int; -#endif - + const unsigned int List::max_int_value + = std::numeric_limits::max(); const char* List::description_init = "[List"; @@ -595,13 +565,8 @@ namespace Patterns - const unsigned int Map::max_int_value = -#ifdef HAVE_STD_NUMERIC_LIMITS - std::numeric_limits::max(); -#else - numbers::invalid_unsigned_int; -#endif - + const unsigned int Map::max_int_value + = std::numeric_limits::max(); const char* Map::description_init = "[Map"; diff --git a/deal.II/source/base/polynomial.cc b/deal.II/source/base/polynomial.cc index df17c1af5f..652c8023c3 100644 --- a/deal.II/source/base/polynomial.cc +++ b/deal.II/source/base/polynomial.cc @@ -18,9 +18,7 @@ #include #include -#ifdef HAVE_STD_NUMERIC_LIMITS -# include -#endif +#include DEAL_II_NAMESPACE_OPEN @@ -86,12 +84,11 @@ namespace Polynomials } // check for underflow and overflow -#ifdef HAVE_STD_NUMERIC_LIMITS Assert (std::fabs(tmp_lagrange_weight) > std::numeric_limits::min(), ExcMessage ("Underflow in computation of Lagrange denominator.")); Assert (std::fabs(tmp_lagrange_weight) < std::numeric_limits::max(), ExcMessage ("Overflow in computation of Lagrange denominator.")); -#endif + lagrange_weight = static_cast(1.)/tmp_lagrange_weight; } diff --git a/deal.II/source/base/quadrature_lib.cc b/deal.II/source/base/quadrature_lib.cc index 93384ec7cf..a38e566433 100644 --- a/deal.II/source/base/quadrature_lib.cc +++ b/deal.II/source/base/quadrature_lib.cc @@ -14,11 +14,9 @@ #include #include -#include -#ifdef HAVE_STD_NUMERIC_LIMITS -# include -#endif +#include +#include DEAL_II_NAMESPACE_OPEN @@ -110,15 +108,9 @@ QGauss<1>::QGauss (const unsigned int n) // emulator only supports 64 bit // arithmetic, even for 80 bit long // doubles. -#ifdef HAVE_STD_NUMERIC_LIMITS const long double long_double_eps = static_cast(std::numeric_limits::epsilon()), double_eps = static_cast(std::numeric_limits::epsilon()); -#else - const long double - long_double_eps = 1.09-19L, - double_eps = 2.23-16; -#endif // now check whether long double is more // accurate than double, and set @@ -210,15 +202,9 @@ compute_quadrature_points(const unsigned int q, // Set tolerance. See class QGauss // for detailed explanation. -#ifdef HAVE_STD_NUMERIC_LIMITS const long double long_double_eps = static_cast(std::numeric_limits::epsilon()), double_eps = static_cast(std::numeric_limits::epsilon()); -#else - const long double - long_double_eps = 1.09-19L, - double_eps = 2.23-16; -#endif // check whether long double is // more accurate than double, and diff --git a/deal.II/source/base/utilities.cc b/deal.II/source/base/utilities.cc index 4cd05eb695..3c25ba69b2 100644 --- a/deal.II/source/base/utilities.cc +++ b/deal.II/source/base/utilities.cc @@ -36,13 +36,7 @@ #include #include #include - -#ifdef HAVE_STD_NUMERIC_LIMITS -# include -#else -# include -#endif - +#include #ifdef DEAL_II_USE_TRILINOS # ifdef DEAL_II_COMPILER_SUPPORTS_MPI @@ -145,16 +139,11 @@ namespace Utilities { std::istringstream ss(s); -#ifdef HAVE_STD_NUMERIC_LIMITS - static const int max_int = std::numeric_limits::max(); -#else - static const int max_int = INT_MAX; -#endif - - int i = max_int; + int i = std::numeric_limits::max(); ss >> i; // check for errors - AssertThrow (i != max_int, ExcCantConvertString (s)); + AssertThrow (i != std::numeric_limits::max(), + ExcCantConvertString (s)); //TODO: The test for errors above doesn't work, as can easily be //verified. furthermore, it doesn't catch cases like when calling @@ -182,17 +171,12 @@ namespace Utilities { std::istringstream ss(s); -#ifdef HAVE_STD_NUMERIC_LIMITS - static const double max_double = std::numeric_limits::max(); -#else - static const double max_double = DBL_MAX; -#endif - - double i = max_double; + double i = std::numeric_limits::max(); ss >> i; // check for errors - AssertThrow (i != max_double, ExcCantConvertString (s)); + AssertThrow (i != std::numeric_limits::max(), + ExcCantConvertString (s)); //TODO: The test for errors above doesn't work, as can easily be //verified. furthermore, it doesn't catch cases like when calling