#include <cmath>
#include <limits>
#include <memory>
+#include <string>
#include <boost/math/quadrature/detail/exp_sinh_detail.hpp>
namespace boost{ namespace math{ namespace quadrature {
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;
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);
}
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);
}