]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/math/quadrature/exp_sinh.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / math / quadrature / exp_sinh.hpp
index d9a5e901732d1db26c1017e77f0e89faca1a6d7e..736acbd11a2d9f60e295a0627dd56cdd7602d72e 100644 (file)
@@ -18,6 +18,7 @@
 #include <cmath>
 #include <limits>
 #include <memory>
+#include <string>
 #include <boost/math/quadrature/detail/exp_sinh_detail.hpp>
 
 namespace boost{ namespace math{ namespace quadrature {
@@ -43,6 +44,8 @@ template<class F>
 auto exp_sinh<Real, Policy>::integrate(const F& f, Real a, Real b, Real tolerance, Real* error, Real* L1, std::size_t* levels)->decltype(std::declval<F>()(std::declval<Real>()))  const
 {
     typedef decltype(f(a)) K;
+    static_assert(!std::is_integral<K>::value,
+                  "The return type cannot be integral, it must be either a real or complex floating point type.");
     using std::abs;
     using boost::math::constants::half;
     using boost::math::quadrature::detail::exp_sinh_detail;
@@ -58,7 +61,7 @@ auto exp_sinh<Real, Policy>::integrate(const F& f, Real a, Real b, Real toleranc
     if ((boost::math::isfinite)(a) && (b >= boost::math::tools::max_value<Real>()))
     {
         // If a = 0, don't use an additional level of indirection:
-        if (a == (Real) 0)
+        if (a == static_cast<Real>(0))
         {
             return m_imp->integrate(f, error, L1, function, tolerance, levels);
         }
@@ -86,6 +89,11 @@ template<class F>
 auto exp_sinh<Real, Policy>::integrate(const F& f, Real tolerance, Real* error, Real* L1, std::size_t* levels)->decltype(std::declval<F>()(std::declval<Real>())) const
 {
     static const char* function = "boost::math::quadrature::exp_sinh<%1%>::integrate";
+    using std::abs;
+    if (abs(tolerance) > 1) {
+        std::string msg = std::string(__FILE__) + ":" + std::to_string(__LINE__) + ":" + std::string(function) + ": The tolerance provided is unusually large; did you confuse it with a domain bound?";
+        throw std::domain_error(msg);
+    }
     return m_imp->integrate(f, error, L1, function, tolerance, levels);
 }