update boost on linux

This commit is contained in:
Bassem Girgis
2019-08-10 16:06:25 -05:00
parent 76ad52be58
commit 861b918727
5363 changed files with 483306 additions and 116507 deletions

View File

@@ -242,38 +242,45 @@ template <class T>
const T& get_constant_ln2()
{
static BOOST_MP_THREAD_LOCAL T result;
static BOOST_MP_THREAD_LOCAL long digits = 0;
#ifndef BOOST_MP_USING_THREAD_LOCAL
static BOOST_MP_THREAD_LOCAL bool b = false;
static BOOST_MP_THREAD_LOCAL long digits = boost::multiprecision::detail::digits2<number<T> >::value();
constant_initializer<T, &get_constant_ln2<T> >::do_nothing();
if(!b || (digits != boost::multiprecision::detail::digits2<number<T> >::value()))
{
calc_log2(result, boost::multiprecision::detail::digits2<number<T, et_on> >::value());
b = true;
#else
if ((digits != boost::multiprecision::detail::digits2<number<T> >::value()))
{
#endif
calc_log2(result, boost::multiprecision::detail::digits2<number<T, et_on> >::value());
digits = boost::multiprecision::detail::digits2<number<T> >::value();
}
constant_initializer<T, &get_constant_ln2<T> >::do_nothing();
return result;
}
#ifndef BOOST_MP_THREAD_LOCAL
#error 1
#endif
template <class T>
const T& get_constant_e()
{
static BOOST_MP_THREAD_LOCAL T result;
static BOOST_MP_THREAD_LOCAL long digits = 0;
#ifndef BOOST_MP_USING_THREAD_LOCAL
static BOOST_MP_THREAD_LOCAL bool b = false;
static BOOST_MP_THREAD_LOCAL long digits = boost::multiprecision::detail::digits2<number<T> >::value();
if(!b || (digits != boost::multiprecision::detail::digits2<number<T> >::value()))
constant_initializer<T, &get_constant_e<T> >::do_nothing();
if (!b || (digits != boost::multiprecision::detail::digits2<number<T> >::value()))
{
calc_e(result, boost::multiprecision::detail::digits2<number<T, et_on> >::value());
b = true;
#else
if ((digits != boost::multiprecision::detail::digits2<number<T> >::value()))
{
#endif
calc_e(result, boost::multiprecision::detail::digits2<number<T, et_on> >::value());
digits = boost::multiprecision::detail::digits2<number<T> >::value();
}
constant_initializer<T, &get_constant_e<T> >::do_nothing();
return result;
}
@@ -281,17 +288,46 @@ template <class T>
const T& get_constant_pi()
{
static BOOST_MP_THREAD_LOCAL T result;
static BOOST_MP_THREAD_LOCAL long digits = 0;
#ifndef BOOST_MP_USING_THREAD_LOCAL
static BOOST_MP_THREAD_LOCAL bool b = false;
static BOOST_MP_THREAD_LOCAL long digits = boost::multiprecision::detail::digits2<number<T> >::value();
if(!b || (digits != boost::multiprecision::detail::digits2<number<T> >::value()))
constant_initializer<T, &get_constant_pi<T> >::do_nothing();
if (!b || (digits != boost::multiprecision::detail::digits2<number<T> >::value()))
{
calc_pi(result, boost::multiprecision::detail::digits2<number<T, et_on> >::value());
b = true;
#else
if ((digits != boost::multiprecision::detail::digits2<number<T> >::value()))
{
#endif
calc_pi(result, boost::multiprecision::detail::digits2<number<T, et_on> >::value());
digits = boost::multiprecision::detail::digits2<number<T> >::value();
}
constant_initializer<T, &get_constant_pi<T> >::do_nothing();
return result;
}
template <class T>
const T& get_constant_one_over_epsilon()
{
static BOOST_MP_THREAD_LOCAL T result;
static BOOST_MP_THREAD_LOCAL long digits = 0;
#ifndef BOOST_MP_USING_THREAD_LOCAL
static BOOST_MP_THREAD_LOCAL bool b = false;
constant_initializer<T, &get_constant_one_over_epsilon<T> >::do_nothing();
if (!b || (digits != boost::multiprecision::detail::digits2<number<T> >::value()))
{
b = true;
#else
if ((digits != boost::multiprecision::detail::digits2<number<T> >::value()))
{
#endif
typedef typename mpl::front<typename T::unsigned_types>::type ui_type;
result = static_cast<ui_type>(1u);
eval_divide(result, std::numeric_limits<number<T> >::epsilon().backend());
}
return result;
}

View File

@@ -88,7 +88,7 @@ inline void pow_imp(T& result, const T& t, const U& p, const mpl::true_&)
} // namespace detail
template<typename T, typename U>
inline typename enable_if<is_integral<U> >::type eval_pow(T& result, const T& t, const U& p)
inline typename enable_if_c<is_integral<U>::value>::type eval_pow(T& result, const T& t, const U& p)
{
detail::pow_imp(result, t, p, boost::is_signed<U>());
}
@@ -303,6 +303,16 @@ void eval_exp(T& result, const T& x)
exp_type n;
eval_convert_to(&n, result);
if (n == (std::numeric_limits<exp_type>::max)())
{
// Exponent is too large to fit in our exponent type:
if (isneg)
result = ui_type(0);
else
result = std::numeric_limits<number<T> >::has_infinity ? std::numeric_limits<number<T> >::infinity().backend() : (std::numeric_limits<number<T> >::max)().backend();
return;
}
// The scaling is 2^11 = 2048.
const si_type p2 = static_cast<si_type>(si_type(1) << 11);
@@ -414,20 +424,25 @@ template <class T>
const T& get_constant_log10()
{
static BOOST_MP_THREAD_LOCAL T result;
static BOOST_MP_THREAD_LOCAL long digits = 0;
#ifndef BOOST_MP_USING_THREAD_LOCAL
static BOOST_MP_THREAD_LOCAL bool b = false;
static BOOST_MP_THREAD_LOCAL long digits = boost::multiprecision::detail::digits2<number<T> >::value();
if(!b || (digits != boost::multiprecision::detail::digits2<number<T> >::value()))
constant_initializer<T, &get_constant_log10<T> >::do_nothing();
if (!b || (digits != boost::multiprecision::detail::digits2<number<T> >::value()))
{
b = true;
#else
if ((digits != boost::multiprecision::detail::digits2<number<T> >::value()))
{
#endif
typedef typename boost::multiprecision::detail::canonical<unsigned, T>::type ui_type;
T ten;
ten = ui_type(10u);
eval_log(result, ten);
b = true;
digits = boost::multiprecision::detail::digits2<number<T> >::value();
}
constant_initializer<T, &get_constant_log10<T> >::do_nothing();
return result;
}
@@ -522,6 +537,7 @@ inline void eval_pow(T& result, const T& x, const T& a)
{
// fallthrough..
}
BOOST_FALLTHROUGH;
}
default:
if(eval_signbit(a))
@@ -705,7 +721,12 @@ inline void eval_pow(T& result, const T& x, const T& a)
}
template<class T, class A>
inline typename enable_if<is_floating_point<A>, void>::type eval_pow(T& result, const T& x, const A& a)
#if BOOST_WORKAROUND(BOOST_MSVC, < 1800)
inline typename enable_if_c<!is_integral<A>::value, void>::type
#else
inline typename enable_if_c<is_compatible_arithmetic_type<A, number<T> >::value && !is_integral<A>::value, void>::type
#endif
eval_pow(T& result, const T& x, const A& a)
{
// Note this one is restricted to float arguments since pow.hpp already has a version for
// integer powers....
@@ -717,7 +738,12 @@ inline typename enable_if<is_floating_point<A>, void>::type eval_pow(T& result,
}
template<class T, class A>
inline typename enable_if<is_arithmetic<A>, void>::type eval_pow(T& result, const A& x, const T& a)
#if BOOST_WORKAROUND(BOOST_MSVC, < 1800)
inline void
#else
inline typename enable_if_c<is_compatible_arithmetic_type<A, number<T> >::value, void>::type
#endif
eval_pow(T& result, const A& x, const T& a)
{
typedef typename boost::multiprecision::detail::canonical<A, T>::type canonical_type;
typedef typename mpl::if_<is_same<A, canonical_type>, T, canonical_type>::type cast_type;

View File

@@ -128,7 +128,13 @@ void eval_sin(T& result, const T& x)
eval_fmod(t, n_pi, t);
const bool b_n_pi_is_even = eval_get_sign(t) == 0;
eval_multiply(n_pi, get_constant_pi<T>());
eval_subtract(xx, n_pi);
if (n_pi.compare(get_constant_one_over_epsilon<T>()) > 0)
{
result = ui_type(0);
return;
}
else
eval_subtract(xx, n_pi);
BOOST_MATH_INSTRUMENT_CODE(xx.str(0, std::ios_base::scientific));
BOOST_MATH_INSTRUMENT_CODE(n_pi.str(0, std::ios_base::scientific));
@@ -276,7 +282,20 @@ void eval_cos(T& result, const T& x)
BOOST_MATH_INSTRUMENT_CODE(n_pi.str(0, std::ios_base::scientific));
eval_multiply(t, n_pi, get_constant_pi<T>());
BOOST_MATH_INSTRUMENT_CODE(t.str(0, std::ios_base::scientific));
eval_subtract(xx, t);
//
// If t is so large that all digits cancel the result of this subtraction
// is completely meaningless, just assume the result is zero for now...
//
// TODO We should of course do much better, see:
// "ARGUMENT REDUCTION FOR HUGE ARGUMENTS" K C Ng 1992
//
if (n_pi.compare(get_constant_one_over_epsilon<T>()) > 0)
{
result = ui_type(1);
return;
}
else
eval_subtract(xx, t);
BOOST_MATH_INSTRUMENT_CODE(xx.str(0, std::ios_base::scientific));
// Adjust signs if the multiple of pi is not even.