]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/math/quadrature/tanh_sinh.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / math / quadrature / tanh_sinh.hpp
index 25c65111deac4a9033c66f03ddd3d06a429505d7..5c63e0466bdde4f36a77daf43f3cbcfdd4e236b0 100644 (file)
@@ -113,6 +113,10 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
           {
              *L1 *= 2;
           }
+          if (error)
+          {
+             *error *= 2;
+          }
 
           return Q;
        }
@@ -140,14 +144,22 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
           {
              *L1 *= 2;
           }
+          if (error)
+          {
+             *error *= 2;
+          }
           return Q;
        }
 
        if ((boost::math::isfinite)(a) && (boost::math::isfinite)(b))
        {
-          if (b <= a)
+          if (a == b)
+          {
+             return result_type(0);
+          }
+          if (b < a)
           {
-             return policies::raise_domain_error(function, "Arguments to integrate are in wrong order; integration over [a,b] must have b > a.", a, Policy());
+             return -this->integrate(f, b, a, tolerance, error, L1, levels);
           }
           Real avg = (a + b)*half<Real>();
           Real diff = (b - a)*half<Real>();
@@ -181,7 +193,7 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
                   return f(diff * (avg_over_diff_m1 - zc));
                 position = a - diff * zc;
              }
-             if (z > 0.5)
+             else if (z > 0.5)
              {
                 if(have_small_right)
                   return f(diff * (avg_over_diff_p1 - zc));
@@ -199,6 +211,10 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
           {
              *L1 *= diff;
           }
+          if (error)
+          {
+             *error *= diff;
+          }
           return Q;
        }
     }
@@ -237,6 +253,10 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
       {
          *L1 *= diff;
       }
+      if (error)
+      {
+         *error *= diff;
+      }
       return Q;
    }
    return policies::raise_domain_error(function, "The domain of integration is not sensible; please check the bounds.", a, Policy());