]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fixed tolerance in class QGaussLobatto to satisfy Mac OS X conditions.
authorprill <prill@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 17 Jan 2007 07:20:02 +0000 (07:20 +0000)
committerprill <prill@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 17 Jan 2007 07:20:02 +0000 (07:20 +0000)
git-svn-id: https://svn.dealii.org/trunk@14326 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/quadrature_lib.cc

index 541af2ceed59ed1c0f342f06fc6c3cfed940fcfc..7e91805cea4bc9b68a02749691f68d93d28a8f2e 100644 (file)
@@ -184,15 +184,29 @@ compute_quadrature_points(const unsigned int q,
                                   // compute quadrature points with
                                   // a Newton algorithm.
 
-                                  // set tolerance
+                                  // Set tolerance. See class QGauss
+                                  // for detailed explanation.
 #ifdef HAVE_STD_NUMERIC_LIMITS
   const long double
-    epsilon = static_cast<long double>(std::numeric_limits<long double>::epsilon());
+    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
-    epsilon = 1.e-19L; 
+    long_double_eps = 1.09-19L,
+    double_eps      = 2.23-16;
 #endif
 
+                                  // check whether long double is
+                                  // more accurate than double, and
+                                  // set tolerances accordingly
+  const long double epsilon
+    = (static_cast<long double>(1.0) + long_double_eps != static_cast<long double>(1.0)
+       ?
+       std::max (double_eps / 100, long_double_eps * 5)
+       :
+       double_eps * 5
+       );
+  
                                   // we take the zeros of the Chebyshev
                                   // polynomial (alpha=beta=-0.5) as
                                   // initial values:

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.