]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use std::numeric_limits::lowest() instead of -max(). 12552/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 7 Jul 2021 23:14:52 +0000 (17:14 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 7 Jul 2021 23:14:52 +0000 (17:14 -0600)
include/deal.II/lac/eigen.h
include/deal.II/lac/solver_gmres.h
include/deal.II/lac/solver_richardson.h
include/deal.II/numerics/error_estimator.templates.h
source/base/mpi.cc
source/base/patterns.cc
source/grid/grid_refinement.cc
tests/arpack/step-36_ar.cc
tests/arpack/step-36_ar_shift.cc
tests/arpack/step-36_ar_with_iterations.cc
tests/simplex/step-31.cc

index a02949b757db2504e401b0bbfd01336a579624bf..91ee6b5fa1ac4ec67c67770dff68d4c102707999 100644 (file)
@@ -321,7 +321,7 @@ EigenInverse<VectorType>::solve(double &          value,
   x *= 1. / length;
 
   // Main loop
-  double    res  = -std::numeric_limits<double>::max();
+  double    res  = std::numeric_limits<double>::lowest();
   size_type iter = 0;
   for (; conv == SolverControl::iterate; iter++)
     {
index 7e359925abd05db5a5cb0d5b1f0c4d6117cab3a7..ff6113d56ca43768ec4277ffc091b271eb65d1f5 100644 (file)
@@ -825,7 +825,7 @@ SolverGMRES<VectorType>::solve(const MatrixType &        A,
   unsigned int dim = 0;
 
   SolverControl::State iteration_state = SolverControl::iterate;
-  double               last_res        = -std::numeric_limits<double>::max();
+  double               last_res        = std::numeric_limits<double>::lowest();
 
   // switch to determine whether we want a left or a right preconditioner. at
   // present, left is default, but both ways are implemented
@@ -1216,7 +1216,7 @@ SolverFGMRES<VectorType>::solve(const MatrixType &        A,
   Vector<double> y;
 
   // Iteration starts here
-  double res = -std::numeric_limits<double>::max();
+  double res = std::numeric_limits<double>::lowest();
 
   typename VectorMemory<VectorType>::Pointer aux(this->memory);
   aux->reinit(x);
index 70d8d5c6d40413983b31358233a945f4c391ab94..d8b68d9f830efe240935238ee0716a13be13de9f 100644 (file)
@@ -197,7 +197,7 @@ SolverRichardson<VectorType>::solve(const MatrixType &        A,
 {
   SolverControl::State conv = SolverControl::iterate;
 
-  double last_criterion = -std::numeric_limits<double>::max();
+  double last_criterion = std::numeric_limits<double>::lowest();
 
   unsigned int iter = 0;
 
@@ -253,7 +253,7 @@ SolverRichardson<VectorType>::Tsolve(const MatrixType &        A,
                                      const PreconditionerType &preconditioner)
 {
   SolverControl::State conv           = SolverControl::iterate;
-  double               last_criterion = -std::numeric_limits<double>::max();
+  double               last_criterion = std::numeric_limits<double>::lowest();
 
   unsigned int iter = 0;
 
index 10b0f655509fb68f744f216744c5e618a1190daf..d320669e4b5bc285cffe77785c734fc6c5317cf7 100644 (file)
@@ -514,7 +514,7 @@ namespace internal
         default:
           {
             Assert(false, ExcNotImplemented());
-            return -std::numeric_limits<double>::max();
+            return std::numeric_limits<double>::lowest();
           }
       }
   }
@@ -558,7 +558,7 @@ namespace internal
         default:
           {
             Assert(false, ExcNotImplemented());
-            return -std::numeric_limits<double>::max();
+            return std::numeric_limits<double>::lowest();
           }
       }
   }
@@ -604,7 +604,7 @@ namespace internal
         default:
           {
             Assert(false, ExcNotImplemented());
-            return -std::numeric_limits<double>::max();
+            return std::numeric_limits<double>::lowest();
           }
       }
   }
@@ -639,7 +639,7 @@ namespace internal
         default:
           {
             Assert(false, ExcNotImplemented());
-            return -std::numeric_limits<double>::max();
+            return std::numeric_limits<double>::lowest();
           }
       }
   }
index 4fda149c7e9a0a7abbe482ba2d393d6c3edf5125..8e4fa7d917864d4beda6b06ec49400fb900c5c67 100644 (file)
@@ -576,7 +576,7 @@ namespace Utilities
       // result with a default value already...
       MinMaxAvg dummy = {0.,
                          std::numeric_limits<double>::max(),
-                         -std::numeric_limits<double>::max(),
+                         std::numeric_limits<double>::lowest(),
                          0,
                          0,
                          0.};
index 765506a5856c05729ce1d99b77e012ba3fcc5ed8..eaf7063c2e1b3821b67b56b25f1b589cb4e714e0 100644 (file)
@@ -344,7 +344,7 @@ namespace Patterns
 
 
 
-  const double Double::min_double_value = -std::numeric_limits<double>::max();
+  const double Double::min_double_value = std::numeric_limits<double>::lowest();
   const double Double::max_double_value = std::numeric_limits<double>::max();
 
   const char *Double::description_init = "[Double";
index fe0a1c3e0a53a64ca19c4230c13a9da356f8c6e3..d230b938a6a0fb625a78377d0080ea4ff213c136 100644 (file)
@@ -354,7 +354,7 @@ GridRefinement::refine_and_coarsen_fixed_number(
       if (refine_cells)
         {
           if (static_cast<size_t>(refine_cells) == criteria.size())
-            refine(tria, criteria, -std::numeric_limits<double>::max());
+            refine(tria, criteria, std::numeric_limits<double>::lowest());
           else
             {
               std::nth_element(tmp.begin(),
index 48752d8dbfb7f1c0ae7fa2e1588d370716211126..67e6ddae5ec03aff6fe273735ddebe1faad4abdc 100644 (file)
@@ -198,7 +198,7 @@ namespace Step36
 
 
     double min_spurious_eigenvalue = std::numeric_limits<double>::max(),
-           max_spurious_eigenvalue = -std::numeric_limits<double>::max();
+           max_spurious_eigenvalue = std::numeric_limits<double>::lowest();
 
     for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
       if (constraints.is_constrained(i))
index d40dba1c86fade388aff0aa4e1317a2580a206c0..a670d43e80ecbbca6d3a6c784615f2d959b81901 100644 (file)
@@ -192,7 +192,7 @@ namespace Step36
 
 
     double min_spurious_eigenvalue = std::numeric_limits<double>::max(),
-           max_spurious_eigenvalue = -std::numeric_limits<double>::max();
+           max_spurious_eigenvalue = std::numeric_limits<double>::lowest();
 
     for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
       if (constraints.is_constrained(i))
index 48752d8dbfb7f1c0ae7fa2e1588d370716211126..67e6ddae5ec03aff6fe273735ddebe1faad4abdc 100644 (file)
@@ -198,7 +198,7 @@ namespace Step36
 
 
     double min_spurious_eigenvalue = std::numeric_limits<double>::max(),
-           max_spurious_eigenvalue = -std::numeric_limits<double>::max();
+           max_spurious_eigenvalue = std::numeric_limits<double>::lowest();
 
     for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
       if (constraints.is_constrained(i))
index 5fa28f8ad11b7b5133458f70ab5a426b186fac6a..116bf5adda6acf04d023e2f388752dd1dc6b3c90 100644 (file)
@@ -359,7 +359,7 @@ namespace Step31
     if (timestep_number != 0)
       {
         double min_temperature = std::numeric_limits<double>::max(),
-               max_temperature = -std::numeric_limits<double>::max();
+               max_temperature = std::numeric_limits<double>::lowest();
         for (const auto &cell : temperature_dof_handler.active_cell_iterators())
           {
             fe_values.reinit(cell);
@@ -381,7 +381,7 @@ namespace Step31
     else
       {
         double min_temperature = std::numeric_limits<double>::max(),
-               max_temperature = -std::numeric_limits<double>::max();
+               max_temperature = std::numeric_limits<double>::lowest();
         for (const auto &cell : temperature_dof_handler.active_cell_iterators())
           {
             fe_values.reinit(cell);

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.