Skip to content

Commit e62a284

Browse files
committed
Fix multiprecision failures
1 parent ef423e8 commit e62a284

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

include/boost/math/special_functions/chebyshev.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#ifndef BOOST_MATH_SPECIAL_CHEBYSHEV_HPP
77
#define BOOST_MATH_SPECIAL_CHEBYSHEV_HPP
88
#include <cmath>
9+
#include <type_traits>
910
#include <boost/math/special_functions/math_fwd.hpp>
1011
#include <boost/math/policies/error_handling.hpp>
1112
#include <boost/math/constants/constants.hpp>
@@ -31,7 +32,7 @@ inline tools::promote_args_t<T1, T2, T3> chebyshev_next(T1 const & x, T2 const &
3132
namespace detail {
3233

3334
// https://stackoverflow.com/questions/5625431/efficient-way-to-compute-pq-exponentiation-where-q-is-an-integer
34-
template <typename T>
35+
template <typename T, typename std::enable_if<std::is_arithmetic<T>::value, bool>::type = true>
3536
T expt(T p, unsigned q)
3637
{
3738
T r = 1;
@@ -48,6 +49,13 @@ T expt(T p, unsigned q)
4849
return r;
4950
}
5051

52+
template <typename T, typename std::enable_if<!std::is_arithmetic<T>::value, bool>::type = true>
53+
T expt(T p, unsigned q)
54+
{
55+
using std::pow;
56+
return static_cast<T>(pow(p, q));
57+
}
58+
5159
template<class Real, bool second, class Policy>
5260
inline Real chebyshev_imp(unsigned n, Real const & x, const Policy&)
5361
{

include/boost/math/special_functions/sqrt1pm1.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ inline typename tools::promote_args<T>::type sqrt1pm1(const T& val, const Policy
2626
typedef typename tools::promote_args<T>::type result_type;
2727
BOOST_MATH_STD_USING
2828

29-
if(fabs(result_type(val)) > T(0.75))
29+
if(fabs(result_type(val)) > 0.75)
3030
return sqrt(1 + result_type(val)) - 1;
3131
return boost::math::expm1(boost::math::log1p(val, pol) / 2, pol);
3232
}

0 commit comments

Comments
 (0)