2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-23 17:52:09 +00:00

Fix local special_fun test failures

This commit is contained in:
Matt Borland
2021-03-13 17:25:30 +03:00
parent e8f60317ef
commit 29bb20b4d2
2 changed files with 19 additions and 19 deletions

View File

@@ -9,12 +9,12 @@
#include <boost/config.hpp>
#include <boost/math/tools/atomic.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/math/tools/toms748_solve.hpp>
#include <boost/math/tools/cxx03_warn.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <vector>
#include <mutex>
#include <type_traits>
namespace boost{ namespace math{ namespace detail{
//
@@ -130,14 +130,15 @@ std::size_t b2n_overflow_limit()
// so to compute the Bernoulli numbers from the tangent numbers, we need to avoid spurious
// overflow in the calculation, we can do this by scaling all the tangent number by some scale factor:
//
template <class T>
inline typename enable_if_c<std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::radix == 2), T>::type tangent_scale_factor()
template <class T, typename std::enable_if<std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::radix == 2), bool>::type = true>
inline T tangent_scale_factor()
{
BOOST_MATH_STD_USING
return ldexp(T(1), std::numeric_limits<T>::min_exponent + 5);
}
template <class T>
inline typename disable_if_c<std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::radix == 2), T>::type tangent_scale_factor()
template <class T, typename std::enable_if<!std::numeric_limits<T>::is_specialized || !(std::numeric_limits<T>::radix == 2), bool>::type = true>
inline T tangent_scale_factor()
{
return tools::min_value<T>() * 16;
}

View File

@@ -12,18 +12,17 @@
#define _BOOST_POLYGAMMA_DETAIL_2013_07_30_HPP_
#include <cmath>
#include <limits>
#include <boost/cstdint.hpp>
#include <boost/math/policies/policy.hpp>
#include <boost/math/special_functions/bernoulli.hpp>
#include <boost/math/special_functions/trunc.hpp>
#include <boost/math/special_functions/zeta.hpp>
#include <boost/math/special_functions/digamma.hpp>
#include <boost/math/special_functions/sin_pi.hpp>
#include <boost/math/special_functions/cos_pi.hpp>
#include <boost/math/special_functions/pow.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <limits>
#include <mutex>
#include <boost/math/policies/policy.hpp>
#include <boost/math/special_functions/bernoulli.hpp>
#include <boost/math/special_functions/trunc.hpp>
#include <boost/math/special_functions/zeta.hpp>
#include <boost/math/special_functions/digamma.hpp>
#include <boost/math/special_functions/sin_pi.hpp>
#include <boost/math/special_functions/cos_pi.hpp>
#include <boost/math/special_functions/pow.hpp>
#include <boost/static_assert.hpp>
#ifdef _MSC_VER
#pragma once
@@ -403,8 +402,8 @@ namespace boost { namespace math { namespace detail{
if((unsigned)n / 2u > policies::get_max_series_iterations<Policy>())
return policies::raise_evaluation_error<T>(function, "The value of n is so large that we're unable to compute the result in reasonable time, best guess is %1%", 0, pol);
#ifdef BOOST_HAS_THREADS
static boost::detail::lightweight_mutex m;
boost::detail::lightweight_mutex::scoped_lock l(m);
static std::mutex m;
std::lock_guard<std::mutex> l(m);
#endif
static int digits = tools::digits<T>();
static std::vector<std::vector<T> > table(1, std::vector<T>(1, T(-1)));