]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Assume that std::numeric_limits is available. This has been the case for a very long...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 11 Sep 2012 13:31:52 +0000 (13:31 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 11 Sep 2012 13:31:52 +0000 (13:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@26283 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/source/base/parameter_handler.cc
deal.II/source/base/polynomial.cc
deal.II/source/base/quadrature_lib.cc
deal.II/source/base/utilities.cc

index 1a628bfea40a8b066aae5f6ac6b69a63b733e1e0..1b409879485e8580df9ea6139eb894c234c037fb 100644 (file)
 #include <list>
 #include <sstream>
 #include <cctype>
+#include <limits>
 
-#ifdef HAVE_STD_NUMERIC_LIMITS
-#  include <limits>
-#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<int>::min();
-#else
-          1;
-#endif
-
-  const int Integer::max_int_value =
-#ifdef HAVE_STD_NUMERIC_LIMITS
-          std::numeric_limits<int>::max();
-#else
-          0;
-#endif
-
+  const int Integer::min_int_value = std::numeric_limits<int>::min();
+  const int Integer::max_int_value = std::numeric_limits<int>::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<double>::max();
-#else
-          1;
-#endif
-
-  const double Double::max_double_value =
-#ifdef HAVE_STD_NUMERIC_LIMITS
-          std::numeric_limits<double>::max();
-#else
-          0;
-#endif
+  const double Double::min_double_value = -std::numeric_limits<double>::max();
+  const double Double::max_double_value = std::numeric_limits<double>::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<unsigned int>::max();
-#else
-          numbers::invalid_unsigned_int;
-#endif
-
+  const unsigned int List::max_int_value
+  = std::numeric_limits<unsigned int>::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<unsigned int>::max();
-#else
-          numbers::invalid_unsigned_int;
-#endif
-
+  const unsigned int Map::max_int_value
+  = std::numeric_limits<unsigned int>::max();
 
   const char* Map::description_init = "[Map";
 
index df17c1af5f714290b0c750bcc1e38be2b751c4c9..652c8023c36d98e0499173c77512c9206c4329a7 100644 (file)
@@ -18,9 +18,7 @@
 #include <deal.II/base/thread_management.h>
 
 #include <cmath>
-#ifdef HAVE_STD_NUMERIC_LIMITS
-#  include <limits>
-#endif
+#include <limits>
 
 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<number>::min(),
             ExcMessage ("Underflow in computation of Lagrange denominator."));
     Assert (std::fabs(tmp_lagrange_weight) < std::numeric_limits<number>::max(),
             ExcMessage ("Overflow in computation of Lagrange denominator."));
-#endif
+
     lagrange_weight = static_cast<number>(1.)/tmp_lagrange_weight;
   }
 
index 93384ec7cf9456814df7f509070a2e071b2c00c8..a38e566433b5fa6c463fbbd722655322f0911c7c 100644 (file)
 
 #include <deal.II/base/quadrature_lib.h>
 #include <deal.II/base/geometry_info.h>
-#include <cmath>
 
-#ifdef HAVE_STD_NUMERIC_LIMITS
-#  include <limits>
-#endif
+#include <cmath>
+#include <limits>
 
 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<long double>(std::numeric_limits<long double>::epsilon()),
     double_eps      = static_cast<long double>(std::numeric_limits<double>::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<long double>(std::numeric_limits<long double>::epsilon()),
     double_eps      = static_cast<long double>(std::numeric_limits<double>::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
index 4cd05eb695172ec11a03750b7a6328ae6b1e8d6c..3c25ba69b22762133e5893188947185d977e2b5e 100644 (file)
 #include <sys/types.h>
 #include <sstream>
 #include <iostream>
-
-#ifdef HAVE_STD_NUMERIC_LIMITS
-#  include <limits>
-#else
-#  include <limits.h>
-#endif
-
+#include <limits>
 
 #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<int>::max();
-#else
-    static const int max_int = INT_MAX;
-#endif
-
-    int i = max_int;
+    int i = std::numeric_limits<int>::max();
     ss >> i;
                                      // check for errors
-    AssertThrow (i != max_int, ExcCantConvertString (s));
+    AssertThrow (i != std::numeric_limits<int>::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<double>::max();
-#else
-    static const double max_double = DBL_MAX;
-#endif
-
-    double i = max_double;
+    double i = std::numeric_limits<double>::max();
     ss >> i;
 
                                      // check for errors
-    AssertThrow (i != max_double, ExcCantConvertString (s));
+    AssertThrow (i != std::numeric_limits<double>::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

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


Typeset in Trocchi and Trocchi Bold Sans Serif.