2
0
mirror of https://github.com/boostorg/math.git synced 2026-02-27 05:02:32 +00:00

[CI SKIP] Merge branch 'develop' into e_float_2021

This commit is contained in:
Christopher Kormanyos
2021-02-14 16:59:12 +01:00
21 changed files with 456 additions and 502 deletions

View File

@@ -8,12 +8,13 @@
#ifndef BOOST_MATH_CALCULATE_CONSTANTS_CONSTANTS_INCLUDED
#define BOOST_MATH_CALCULATE_CONSTANTS_CONSTANTS_INCLUDED
#include <boost/static_assert.hpp>
#include <type_traits>
namespace boost{ namespace math{ namespace constants{ namespace detail{
template <class T>
template<int N>
inline T constant_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
@@ -68,21 +69,21 @@ inline T constant_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::
template <class T>
template<int N>
inline T constant_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return 2 * pi<T, policies::policy<policies::digits2<N> > >();
}
template <class T> // 2 / pi
template<int N>
inline T constant_two_div_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_two_div_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return 2 / pi<T, policies::policy<policies::digits2<N> > >();
}
template <class T> // sqrt(2/pi)
template <int N>
inline T constant_root_two_div_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_root_two_div_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sqrt((2 / pi<T, policies::policy<policies::digits2<N> > >()));
@@ -90,14 +91,14 @@ inline T constant_root_two_div_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_
template <class T>
template<int N>
inline T constant_one_div_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_one_div_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return 1 / two_pi<T, policies::policy<policies::digits2<N> > >();
}
template <class T>
template<int N>
inline T constant_root_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_root_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sqrt(pi<T, policies::policy<policies::digits2<N> > >());
@@ -105,7 +106,7 @@ inline T constant_root_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((bo
template <class T>
template<int N>
inline T constant_root_half_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_root_half_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sqrt(pi<T, policies::policy<policies::digits2<N> > >() / 2);
@@ -113,7 +114,7 @@ inline T constant_root_half_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPE
template <class T>
template<int N>
inline T constant_root_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_root_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sqrt(two_pi<T, policies::policy<policies::digits2<N> > >());
@@ -121,7 +122,7 @@ inline T constant_root_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC
template <class T>
template<int N>
inline T constant_log_root_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_log_root_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return log(root_two_pi<T, policies::policy<policies::digits2<N> > >());
@@ -129,7 +130,7 @@ inline T constant_log_root_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_
template <class T>
template<int N>
inline T constant_root_ln_four<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_root_ln_four<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sqrt(log(static_cast<T>(4)));
@@ -137,7 +138,7 @@ inline T constant_root_ln_four<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPE
template <class T>
template<int N>
inline T constant_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
//
// Although we can clearly calculate this from first principles, this hooks into
@@ -150,14 +151,14 @@ inline T constant_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::i
template <class T>
template<int N>
inline T constant_half<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_half<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return static_cast<T>(1) / static_cast<T>(2);
}
template <class T>
template<int M>
inline T constant_euler<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, M>)))
inline T constant_euler<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, M>)))
{
BOOST_MATH_STD_USING
//
@@ -192,7 +193,7 @@ inline T constant_euler<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boos
template <class T>
template<int N>
inline T constant_euler_sqr<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_euler_sqr<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return euler<T, policies::policy<policies::digits2<N> > >()
@@ -201,7 +202,7 @@ inline T constant_euler_sqr<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((
template <class T>
template<int N>
inline T constant_one_div_euler<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_one_div_euler<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return static_cast<T>(1)
@@ -211,7 +212,7 @@ inline T constant_one_div_euler<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SP
template <class T>
template<int N>
inline T constant_root_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_root_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sqrt(static_cast<T>(2));
@@ -220,7 +221,7 @@ inline T constant_root_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((b
template <class T>
template<int N>
inline T constant_root_three<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_root_three<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sqrt(static_cast<T>(3));
@@ -228,7 +229,7 @@ inline T constant_root_three<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(
template <class T>
template<int N>
inline T constant_half_root_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_half_root_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sqrt(static_cast<T>(2)) / 2;
@@ -236,7 +237,7 @@ inline T constant_half_root_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SP
template <class T>
template<int N>
inline T constant_ln_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_ln_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
//
// Although there are good ways to calculate this from scratch, this hooks into
@@ -249,7 +250,7 @@ inline T constant_ln_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boo
template <class T>
template<int N>
inline T constant_ln_ten<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_ln_ten<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return log(static_cast<T>(10));
@@ -257,7 +258,7 @@ inline T constant_ln_ten<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boo
template <class T>
template<int N>
inline T constant_ln_ln_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_ln_ln_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return log(log(static_cast<T>(2)));
@@ -265,7 +266,7 @@ inline T constant_ln_ln_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((
template <class T>
template<int N>
inline T constant_third<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_third<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return static_cast<T>(1) / static_cast<T>(3);
@@ -273,7 +274,7 @@ inline T constant_third<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boos
template <class T>
template<int N>
inline T constant_twothirds<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_twothirds<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return static_cast<T>(2) / static_cast<T>(3);
@@ -281,7 +282,7 @@ inline T constant_twothirds<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((
template <class T>
template<int N>
inline T constant_two_thirds<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_two_thirds<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return static_cast<T>(2) / static_cast<T>(3);
@@ -289,7 +290,7 @@ inline T constant_two_thirds<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(
template <class T>
template<int N>
inline T constant_three_quarters<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_three_quarters<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return static_cast<T>(3) / static_cast<T>(4);
@@ -297,7 +298,7 @@ inline T constant_three_quarters<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_S
template <class T>
template<int N>
inline T constant_sixth<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_sixth<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return static_cast<T>(1) / static_cast<T>(6);
@@ -306,21 +307,21 @@ inline T constant_sixth<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boos
// Pi and related constants.
template <class T>
template<int N>
inline T constant_pi_minus_three<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_pi_minus_three<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return pi<T, policies::policy<policies::digits2<N> > >() - static_cast<T>(3);
}
template <class T>
template<int N>
inline T constant_four_minus_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_four_minus_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return static_cast<T>(4) - pi<T, policies::policy<policies::digits2<N> > >();
}
template <class T>
template<int N>
inline T constant_exp_minus_half<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_exp_minus_half<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return exp(static_cast<T>(-0.5));
@@ -328,7 +329,7 @@ inline T constant_exp_minus_half<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_S
template <class T>
template<int N>
inline T constant_exp_minus_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_exp_minus_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return exp(static_cast<T>(-1.));
@@ -336,28 +337,28 @@ inline T constant_exp_minus_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SP
template <class T>
template<int N>
inline T constant_one_div_root_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_one_div_root_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return static_cast<T>(1) / root_two<T, policies::policy<policies::digits2<N> > >();
}
template <class T>
template<int N>
inline T constant_one_div_root_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_one_div_root_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return static_cast<T>(1) / root_pi<T, policies::policy<policies::digits2<N> > >();
}
template <class T>
template<int N>
inline T constant_one_div_root_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_one_div_root_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return static_cast<T>(1) / root_two_pi<T, policies::policy<policies::digits2<N> > >();
}
template <class T>
template<int N>
inline T constant_root_one_div_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_root_one_div_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sqrt(static_cast<T>(1) / pi<T, policies::policy<policies::digits2<N> > >());
@@ -365,7 +366,7 @@ inline T constant_root_one_div_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_
template <class T>
template<int N>
inline T constant_four_thirds_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_four_thirds_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pi<T, policies::policy<policies::digits2<N> > >() * static_cast<T>(4) / static_cast<T>(3);
@@ -373,7 +374,7 @@ inline T constant_four_thirds_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_S
template <class T>
template<int N>
inline T constant_half_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_half_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pi<T, policies::policy<policies::digits2<N> > >() / static_cast<T>(2);
@@ -381,7 +382,7 @@ inline T constant_half_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((bo
template <class T>
template<int N>
inline T constant_third_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_third_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pi<T, policies::policy<policies::digits2<N> > >() / static_cast<T>(3);
@@ -389,7 +390,7 @@ inline T constant_third_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((b
template <class T>
template<int N>
inline T constant_sixth_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_sixth_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pi<T, policies::policy<policies::digits2<N> > >() / static_cast<T>(6);
@@ -397,7 +398,7 @@ inline T constant_sixth_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((b
template <class T>
template<int N>
inline T constant_two_thirds_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_two_thirds_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pi<T, policies::policy<policies::digits2<N> > >() * static_cast<T>(2) / static_cast<T>(3);
@@ -405,7 +406,7 @@ inline T constant_two_thirds_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SP
template <class T>
template<int N>
inline T constant_three_quarters_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_three_quarters_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pi<T, policies::policy<policies::digits2<N> > >() * static_cast<T>(3) / static_cast<T>(4);
@@ -413,7 +414,7 @@ inline T constant_three_quarters_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYP
template <class T>
template<int N>
inline T constant_pi_pow_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_pi_pow_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pow(pi<T, policies::policy<policies::digits2<N> > >(), e<T, policies::policy<policies::digits2<N> > >()); //
@@ -421,7 +422,7 @@ inline T constant_pi_pow_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((b
template <class T>
template<int N>
inline T constant_pi_sqr<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_pi_sqr<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pi<T, policies::policy<policies::digits2<N> > >()
@@ -430,7 +431,7 @@ inline T constant_pi_sqr<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boo
template <class T>
template<int N>
inline T constant_pi_sqr_div_six<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_pi_sqr_div_six<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pi<T, policies::policy<policies::digits2<N> > >()
@@ -440,7 +441,7 @@ inline T constant_pi_sqr_div_six<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_S
template <class T>
template<int N>
inline T constant_pi_cubed<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_pi_cubed<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pi<T, policies::policy<policies::digits2<N> > >()
@@ -451,7 +452,7 @@ inline T constant_pi_cubed<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((b
template <class T>
template<int N>
inline T constant_cbrt_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_cbrt_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pow(pi<T, policies::policy<policies::digits2<N> > >(), static_cast<T>(1)/ static_cast<T>(3));
@@ -459,7 +460,7 @@ inline T constant_cbrt_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((bo
template <class T>
template<int N>
inline T constant_one_div_cbrt_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_one_div_cbrt_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return static_cast<T>(1)
@@ -470,7 +471,7 @@ inline T constant_one_div_cbrt_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_
template <class T>
template<int N>
inline T constant_e_pow_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_e_pow_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pow(e<T, policies::policy<policies::digits2<N> > >(), pi<T, policies::policy<policies::digits2<N> > >()); //
@@ -478,7 +479,7 @@ inline T constant_e_pow_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((b
template <class T>
template<int N>
inline T constant_root_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_root_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sqrt(e<T, policies::policy<policies::digits2<N> > >());
@@ -486,7 +487,7 @@ inline T constant_root_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boo
template <class T>
template<int N>
inline T constant_log10_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_log10_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return log10(e<T, policies::policy<policies::digits2<N> > >());
@@ -494,7 +495,7 @@ inline T constant_log10_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((bo
template <class T>
template<int N>
inline T constant_one_div_log10_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_one_div_log10_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return static_cast<T>(1) /
@@ -505,7 +506,7 @@ inline T constant_one_div_log10_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_
template <class T>
template<int N>
inline T constant_degree<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_degree<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return pi<T, policies::policy<policies::digits2<N> > >()
@@ -515,7 +516,7 @@ inline T constant_degree<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boo
template <class T>
template<int N>
inline T constant_radian<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_radian<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return static_cast<T>(180)
@@ -525,7 +526,7 @@ inline T constant_radian<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boo
template <class T>
template<int N>
inline T constant_sin_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_sin_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sin(static_cast<T>(1)) ; //
@@ -533,7 +534,7 @@ inline T constant_sin_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((bo
template <class T>
template<int N>
inline T constant_cos_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_cos_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return cos(static_cast<T>(1)) ; //
@@ -541,7 +542,7 @@ inline T constant_cos_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((bo
template <class T>
template<int N>
inline T constant_sinh_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_sinh_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return sinh(static_cast<T>(1)) ; //
@@ -549,7 +550,7 @@ inline T constant_sinh_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((b
template <class T>
template<int N>
inline T constant_cosh_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_cosh_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return cosh(static_cast<T>(1)) ; //
@@ -557,7 +558,7 @@ inline T constant_cosh_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((b
template <class T>
template<int N>
inline T constant_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return (static_cast<T>(1) + sqrt(static_cast<T>(5)) )/static_cast<T>(2) ; //
@@ -565,7 +566,7 @@ inline T constant_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost:
template <class T>
template<int N>
inline T constant_ln_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_ln_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return log((static_cast<T>(1) + sqrt(static_cast<T>(5)) )/static_cast<T>(2) );
@@ -573,7 +574,7 @@ inline T constant_ln_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boo
template <class T>
template<int N>
inline T constant_one_div_ln_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_one_div_ln_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
return static_cast<T>(1) /
@@ -584,7 +585,7 @@ inline T constant_one_div_ln_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_S
template <class T>
template<int N>
inline T constant_zeta_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_zeta_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
@@ -595,7 +596,7 @@ inline T constant_zeta_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((b
template <class T>
template<int N>
inline T constant_zeta_three<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_zeta_three<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
// http://mathworld.wolfram.com/AperysConstant.html
// http://en.wikipedia.org/wiki/Mathematical_constant
@@ -655,7 +656,7 @@ inline T constant_zeta_three<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(
template <class T>
template<int N>
inline T constant_catalan<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_catalan<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{ // http://oeis.org/A006752/constant
//T c("0.915965594177219015054603514932384110774"
//"149374281672134266498119621763019776254769479356512926115106248574");
@@ -755,7 +756,7 @@ T khinchin(int digits)
template <class T>
template<int N>
inline T constant_khinchin<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_khinchin<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
int n = N ? (std::min)(N, tools::digits<T>()) : tools::digits<T>();
return khinchin_detail::khinchin<T>(n);
@@ -763,7 +764,7 @@ inline T constant_khinchin<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((b
template <class T>
template<int N>
inline T constant_extreme_value_skewness<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_extreme_value_skewness<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{ // from e_float constants.cpp
// Mathematica: N[12 Sqrt[6] Zeta[3]/Pi^3, 1101]
BOOST_MATH_STD_USING
@@ -870,7 +871,7 @@ inline T zeta_derivative_2(unsigned n)
template <class T>
template<int N>
inline T constant_glaisher<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_glaisher<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
@@ -910,7 +911,7 @@ inline T constant_glaisher<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((b
template <class T>
template<int N>
inline T constant_rayleigh_skewness<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_rayleigh_skewness<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{ // From e_float
// 1100 digits of the Rayleigh distribution skewness
// Mathematica: N[2 Sqrt[Pi] (Pi - 3)/((4 - Pi)^(3/2)), 1100]
@@ -938,7 +939,7 @@ inline T constant_rayleigh_skewness<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYP
template <class T>
template<int N>
inline T constant_rayleigh_kurtosis_excess<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_rayleigh_kurtosis_excess<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{ // - (6 Pi^2 - 24 Pi + 16)/((Pi - 4)^2)
// Might provide and calculate this using pi_minus_four.
BOOST_MATH_STD_USING
@@ -953,7 +954,7 @@ inline T constant_rayleigh_kurtosis_excess<T>::compute(BOOST_MATH_EXPLICIT_TEMPL
template <class T>
template<int N>
inline T constant_rayleigh_kurtosis<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_rayleigh_kurtosis<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{ // 3 - (6 Pi^2 - 24 Pi + 16)/((Pi - 4)^2)
// Might provide and calculate this using pi_minus_four.
BOOST_MATH_STD_USING
@@ -968,28 +969,28 @@ inline T constant_rayleigh_kurtosis<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYP
template <class T>
template<int N>
inline T constant_log2_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_log2_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return 1 / boost::math::constants::ln_two<T>();
}
template <class T>
template<int N>
inline T constant_quarter_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_quarter_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return boost::math::constants::pi<T>() / 4;
}
template <class T>
template<int N>
inline T constant_one_div_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_one_div_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return 1 / boost::math::constants::pi<T>();
}
template <class T>
template<int N>
inline T constant_two_div_root_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_two_div_root_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
return 2 * boost::math::constants::one_div_root_pi<T>();
}
@@ -997,7 +998,7 @@ inline T constant_two_div_root_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900)
template <class T>
template<int N>
inline T constant_first_feigenbaum<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_first_feigenbaum<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
// We know the constant to 1018 decimal digits.
// See: http://www.plouffe.fr/simon/constants/feigenbaum.txt
@@ -1011,7 +1012,7 @@ inline T constant_first_feigenbaum<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE
template <class T>
template<int N>
inline T constant_plastic<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_plastic<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
using std::cbrt;
using std::sqrt;
@@ -1021,7 +1022,7 @@ inline T constant_plastic<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((bo
template <class T>
template<int N>
inline T constant_gauss<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_gauss<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
using std::sqrt;
T a = sqrt(T(2));
@@ -1039,7 +1040,7 @@ inline T constant_gauss<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boos
template <class T>
template<int N>
inline T constant_dottie<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_dottie<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
// Error analysis: cos(x(1+d)) - x(1+d) = -(sin(x)+1)xd; plug in x = 0.739 gives -1.236d; take d as half an ulp gives the termination criteria we want.
using std::cos;
@@ -1057,7 +1058,7 @@ inline T constant_dottie<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boo
template <class T>
template<int N>
inline T constant_reciprocal_fibonacci<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_reciprocal_fibonacci<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
// Wikipedia says Gosper has deviced a faster algorithm for this, but I read the linked paper and couldn't see it!
// In any case, k bits per iteration is fine, though it would be better to sum from smallest to largest.
@@ -1078,7 +1079,7 @@ inline T constant_reciprocal_fibonacci<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_
template <class T>
template<int N>
inline T constant_laplace_limit<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((boost::integral_constant<int, N>)))
inline T constant_laplace_limit<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
// If x is the exact root, then the approximate root is given by x(1+delta).
// Plugging this into the equation for the Laplace limit gives the residual of approximately

View File

@@ -47,7 +47,6 @@
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#include <limits> // using std::numeric_limits;
#include <utility>

View File

@@ -55,7 +55,6 @@
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#include <limits> // using std::numeric_limits;
#include <utility>

View File

@@ -14,10 +14,8 @@
#include <boost/math/policies/error_handling.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/mpl/divides.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <type_traits>
#include <cstdint>
namespace boost{ namespace math{
@@ -26,20 +24,20 @@ namespace detail
struct big_int_type
{
operator boost::uintmax_t()const;
operator std::uintmax_t() const;
};
template <class T>
template <typename T>
struct largest_cbrt_int_type
{
typedef typename mpl::if_c<
boost::is_convertible<big_int_type, T>::value,
boost::uintmax_t,
using type = typename std::conditional<
std::is_convertible<big_int_type, T>::value,
std::uintmax_t,
unsigned int
>::type type;
>::type;
};
template <class T, class Policy>
template <typename T, typename Policy>
T cbrt_imp(T z, const Policy& pol)
{
BOOST_MATH_STD_USING
@@ -87,7 +85,7 @@ T cbrt_imp(T z, const Policy& pol)
guess = tools::evaluate_polynomial(P, guess);
int i_exp3 = i_exp / 3;
typedef typename largest_cbrt_int_type<T>::type shift_type;
using shift_type = typename largest_cbrt_int_type<T>::type;
BOOST_STATIC_ASSERT( ::std::numeric_limits<shift_type>::radix == 2);
@@ -111,15 +109,15 @@ T cbrt_imp(T z, const Policy& pol)
// checking of the boilerplate version as we know in advance that the function
// is well behaved...
//
typedef typename policies::precision<T, Policy>::type prec;
typedef typename mpl::divides<prec, boost::integral_constant<int, 3> >::type prec3;
typedef typename mpl::plus<prec3, boost::integral_constant<int, 3> >::type new_prec;
typedef typename policies::normalise<Policy, policies::digits2<new_prec::value> >::type new_policy;
using prec = typename policies::precision<T, Policy>::type;
constexpr auto prec3 = prec::value / 3;
constexpr auto new_prec = prec3 + 3;
using new_policy = typename policies::normalise<Policy, policies::digits2<new_prec>>::type;
//
// Epsilon calculation uses compile time arithmetic when it's available for type T,
// otherwise uses ldexp to calculate at runtime:
//
T eps = (new_prec::value > 3) ? policies::get_epsilon<T, new_policy>() : ldexp(T(1), -2 - tools::digits<T>() / 3);
T eps = (new_prec > 3) ? policies::get_epsilon<T, new_policy>() : ldexp(T(1), -2 - tools::digits<T>() / 3);
T diff;
if(original_i_exp < std::numeric_limits<T>::max_exponent - 3)
@@ -155,15 +153,15 @@ T cbrt_imp(T z, const Policy& pol)
} // namespace detail
template <class T, class Policy>
template <typename T, typename Policy>
inline typename tools::promote_args<T>::type cbrt(T z, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
typedef typename policies::evaluation<result_type, Policy>::type value_type;
using result_type = typename tools::promote_args<T>::type;
using value_type = typename policies::evaluation<result_type, Policy>::type;
return static_cast<result_type>(detail::cbrt_imp(value_type(z), pol));
}
template <class T>
template <typename T>
inline typename tools::promote_args<T>::type cbrt(T z)
{
return cbrt(z, policies::policy<>());

View File

@@ -20,7 +20,6 @@
#include <boost/math/special_functions/detail/bessel_jy_series.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/policies/error_handling.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <complex>

View File

@@ -22,8 +22,6 @@
#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/mpl/if.hpp>
#include <boost/mpl/int.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_convertible.hpp>

View File

@@ -16,7 +16,6 @@
#include <boost/math/policies/error_handling.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/mpl/int.hpp>
#include <boost/type_traits/is_convertible.hpp>
#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES

View File

@@ -18,7 +18,6 @@
#include <boost/math/tools/promotion.hpp>
#include <boost/math/policies/error_handling.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/mpl/comparison.hpp>
#include <boost/math/tools/big_constant.hpp>
#if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128)

View File

@@ -10,8 +10,7 @@
#pragma once
#endif
#include <boost/config/no_tr1/cmath.hpp>
#include <math.h> // platform's ::expm1
#include <cmath>
#include <boost/limits.hpp>
#include <boost/math/tools/config.hpp>
#include <boost/math/tools/series.hpp>
@@ -20,7 +19,6 @@
#include <boost/math/policies/error_handling.hpp>
#include <boost/math/tools/rational.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/mpl/less_equal.hpp>
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
# include <boost/static_assert.hpp>

View File

@@ -35,11 +35,8 @@
#include <boost/math/special_functions/polygamma.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/assert.hpp>
#include <boost/mpl/greater.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/greater.hpp>
#include <boost/config/no_tr1/cmath.hpp>
#include <cmath>
#include <algorithm>
#ifdef BOOST_MSVC

View File

@@ -58,7 +58,6 @@ BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES_ITERATIONS // Show evaluation of
#include <boost/math/tools/series.hpp> // series functor.
//#include <boost/math/tools/polynomial.hpp> // polynomial.
#include <boost/math/tools/rational.hpp> // evaluate_polynomial.
#include <boost/mpl/int.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/math/tools/precision.hpp> // boost::math::tools::max_value().
#include <boost/math/tools/big_constant.hpp>
@@ -68,13 +67,15 @@ BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES_ITERATIONS // Show evaluation of
#include <cmath>
#include <limits>
#include <exception>
#include <type_traits>
#include <cstdint>
// Needed for testing and diagnostics only.
#include <iostream>
#include <typeinfo>
#include <boost/math/special_functions/next.hpp> // For float_distance.
typedef double lookup_t; // Type for lookup table (double or float, or even long double?)
using lookup_t = double; // Type for lookup table (double or float, or even long double?)
//#include "J:\Cpp\Misc\lambert_w_lookup_table_generator\lambert_w_lookup_table.ipp"
// #include "lambert_w_lookup_table.ipp" // Boost.Math version.
@@ -104,14 +105,14 @@ namespace lambert_w_detail {
//! \param z Argument z for Lambert_w function.
//! \returns New estimate of Lambert W, hopefully improved.
//!
template <class T>
template <typename T>
inline T lambert_w_halley_step(T w_est, const T z)
{
BOOST_MATH_STD_USING
T e = exp(w_est);
w_est -= 2 * (w_est + 1) * (e * w_est - z) / (z * (w_est + 2) + e * (w_est * (w_est + 2) + 2));
return w_est;
} // template <class T> lambert_w_halley_step(T w_est, T z)
} // template <typename T> lambert_w_halley_step(T w_est, T z)
//! \brief Halley iterate to refine Lambert_w estimate,
//! taking at least one Halley_step.
@@ -121,9 +122,8 @@ inline T lambert_w_halley_step(T w_est, const T z)
//! \tparam T floating-point (or fixed-point) type.
//! \param z Argument z for Lambert_w function.
//! \param w_est Lambert w estimate.
template <class T>
inline
T lambert_w_halley_iterate(T w_est, const T z)
template <typename T>
inline T lambert_w_halley_iterate(T w_est, const T z)
{
BOOST_MATH_STD_USING
static const T max_diff = boost::math::tools::root_epsilon<T>() * fabs(w_est);
@@ -137,21 +137,19 @@ inline
diff = fabs(w_est - w_new);
}
return w_new;
} // template <class T> lambert_w_halley_iterate(T w_est, T z)
} // template <typename T> lambert_w_halley_iterate(T w_est, T z)
// Two Halley function versions that either
// single step (if boost::false_type) or iterate (if boost::true_type).
// single step (if std::false_type) or iterate (if std::true_type).
// Selected at compile-time using parameter 3.
template <class T>
inline
T lambert_w_maybe_halley_iterate(T z, T w, boost::false_type const&)
template <typename T>
inline T lambert_w_maybe_halley_iterate(T z, T w, std::false_type const&)
{
return lambert_w_halley_step(z, w); // Single step.
}
template <class T>
inline
T lambert_w_maybe_halley_iterate(T z, T w, boost::true_type const&)
template <typename T>
inline T lambert_w_maybe_halley_iterate(T z, T w, std::true_type const&)
{
return lambert_w_halley_iterate(z, w); // Iterate steps.
}
@@ -161,30 +159,26 @@ T lambert_w_maybe_halley_iterate(T z, T w, boost::true_type const&)
//! reduce argument z to double precision (if true_type).
//! Version is selected at compile-time using parameter 2.
template <class T>
inline
double maybe_reduce_to_double(const T& z, const boost::true_type&)
template <typename T>
inline double maybe_reduce_to_double(const T& z, const std::true_type&)
{
return static_cast<double>(z); // Reduce to double precision.
}
template <class T>
inline
T maybe_reduce_to_double(const T& z, const boost::false_type&)
template <typename T>
inline T maybe_reduce_to_double(const T& z, const std::false_type&)
{ // Don't reduce to double.
return z;
}
template <class T>
inline
double must_reduce_to_double(const T& z, const boost::true_type&)
template <typename T>
inline double must_reduce_to_double(const T& z, const std::true_type&)
{
return static_cast<double>(z); // Reduce to double precision.
}
template <class T>
inline
double must_reduce_to_double(const T& z, const boost::false_type&)
template <typename T>
inline double must_reduce_to_double(const T& z, const std::false_type&)
{ // try a lexical_cast and hope for the best:
return boost::lexical_cast<double>(z);
}
@@ -201,8 +195,7 @@ double must_reduce_to_double(const T& z, const boost::false_type&)
// Schroeder refinement, called unless NOT required by precision policy.
template<typename T>
inline
T schroeder_update(const T w, const T y)
inline T schroeder_update(const T w, const T y)
{
// Compute derivatives using 5th order Schroeder refinement.
// Since this is the final step, it will always use the highest precision type T.
@@ -496,28 +489,28 @@ T lambert_w_singularity_series(const T p)
//! but for the tag_type selection to work, they all must include Policy in their signature.
// Forward declaration of variants of lambert_w0_small_z.
template <class T, class Policy>
T lambert_w0_small_z(T x, const Policy&, boost::integral_constant<int, 0> const&); // for float (32-bit) type.
template <typename T, typename Policy>
T lambert_w0_small_z(T x, const Policy&, std::integral_constant<int, 0> const&); // for float (32-bit) type.
template <class T, class Policy>
T lambert_w0_small_z(T x, const Policy&, boost::integral_constant<int, 1> const&); // for double (64-bit) type.
template <typename T, typename Policy>
T lambert_w0_small_z(T x, const Policy&, std::integral_constant<int, 1> const&); // for double (64-bit) type.
template <class T, class Policy>
T lambert_w0_small_z(T x, const Policy&, boost::integral_constant<int, 2> const&); // for long double (double extended 80-bit) type.
template <typename T, typename Policy>
T lambert_w0_small_z(T x, const Policy&, std::integral_constant<int, 2> const&); // for long double (double extended 80-bit) type.
template <class T, class Policy>
T lambert_w0_small_z(T x, const Policy&, boost::integral_constant<int, 3> const&); // for long double (128-bit) type.
template <typename T, typename Policy>
T lambert_w0_small_z(T x, const Policy&, std::integral_constant<int, 3> const&); // for long double (128-bit) type.
template <class T, class Policy>
T lambert_w0_small_z(T x, const Policy&, boost::integral_constant<int, 4> const&); // for float128 quadmath Q type.
template <typename T, typename Policy>
T lambert_w0_small_z(T x, const Policy&, std::integral_constant<int, 4> const&); // for float128 quadmath Q type.
template <class T, class Policy>
T lambert_w0_small_z(T x, const Policy&, boost::integral_constant<int, 5> const&); // Generic multiprecision T.
template <typename T, typename Policy>
T lambert_w0_small_z(T x, const Policy&, std::integral_constant<int, 5> const&); // Generic multiprecision T.
// Set tag_type depending on max_digits10.
template <class T, class Policy>
template <typename T, typename Policy>
T lambert_w0_small_z(T x, const Policy& pol)
{ //std::numeric_limits<T>::max_digits10 == 36 ? 3 : // 128-bit long double.
typedef boost::integral_constant<int,
using tag_type = std::integral_constant<int,
std::numeric_limits<T>::is_specialized == 0 ? 5 :
#ifndef BOOST_NO_CXX11_NUMERIC_LIMITS
std::numeric_limits<T>::max_digits10 <= 9 ? 0 : // for float 32-bit.
@@ -531,11 +524,10 @@ T lambert_w0_small_z(T x, const Policy& pol)
std::numeric_limits<T>::digits <= 64 ? 2 : // for 80-bit double extended.
std::numeric_limits<T>::digits <= 113 ? 4 // for both 128-bit long double (3) and 128-bit quad suffix Q type (4).
#endif
: 5 // All Generic multiprecision types.
> tag_type;
: 5>; // All Generic multiprecision types.
// std::cout << "\ntag type = " << tag_type << std::endl; // error C2275: 'tag_type': illegal use of this type as an expression.
return lambert_w0_small_z(x, pol, tag_type());
} // template <class T> T lambert_w0_small_z(T x)
} // template <typename T> T lambert_w0_small_z(T x)
//! Specialization of float (32-bit) series expansion used for small z (abs(z) < 0.05).
// Only 9 Coefficients are computed to 21 decimal digits precision, ample for 32-bit float used by most platforms.
@@ -543,8 +535,8 @@ T lambert_w0_small_z(T x, const Policy& pol)
// N[InverseSeries[Series[z Exp[z],{z,0,34}]],50],
// as proposed by Tosio Fukushima and implemented by Darko Veberic.
template <class T, class Policy>
T lambert_w0_small_z(T z, const Policy&, boost::integral_constant<int, 0> const&)
template <typename T, typename Policy>
T lambert_w0_small_z(T z, const Policy&, std::integral_constant<int, 0> const&)
{
#ifdef BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
std::streamsize prec = std::cout.precision(std::numeric_limits<T>::max_digits10); // Save.
@@ -568,15 +560,15 @@ T lambert_w0_small_z(T z, const Policy&, boost::integral_constant<int, 0> const&
#endif // BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
return result;
} // template <class T> T lambert_w0_small_z(T x, boost::integral_constant<int, 0> const&)
} // template <typename T> T lambert_w0_small_z(T x, std::integral_constant<int, 0> const&)
//! Specialization of double (64-bit double) series expansion used for small z (abs(z) < 0.05).
// 17 Coefficients are computed to 21 decimal digits precision suitable for 64-bit double used by most platforms.
// Taylor series coefficients used are computed by Wolfram to 50 decimal digits using instruction
// N[InverseSeries[Series[z Exp[z],{z,0,34}]],50], as proposed by Tosio Fukushima and implemented by Veberic.
template <class T, class Policy>
T lambert_w0_small_z(const T z, const Policy&, boost::integral_constant<int, 1> const&)
template <typename T, typename Policy>
T lambert_w0_small_z(const T z, const Policy&, std::integral_constant<int, 1> const&)
{
#ifdef BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
std::streamsize prec = std::cout.precision(std::numeric_limits<T>::max_digits10); // Save.
@@ -608,15 +600,15 @@ T lambert_w0_small_z(const T z, const Policy&, boost::integral_constant<int, 1>
#endif // BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
return result;
} // T lambert_w0_small_z(const T z, boost::integral_constant<int, 1> const&)
} // T lambert_w0_small_z(const T z, std::integral_constant<int, 1> const&)
//! Specialization of long double (80-bit double extended) series expansion used for small z (abs(z) < 0.05).
// 21 Coefficients are computed to 21 decimal digits precision suitable for 80-bit long double used by some
// platforms including GCC and Clang when generating for Intel X86 floating-point processors with 80-bit operations enabled (the default).
// (This is NOT used by Microsoft Visual Studio where double and long always both use only 64-bit type.
// Nor used for 128-bit float128.)
template <class T, class Policy>
T lambert_w0_small_z(const T z, const Policy&, boost::integral_constant<int, 2> const&)
template <typename T, typename Policy>
T lambert_w0_small_z(const T z, const Policy&, std::integral_constant<int, 2> const&)
{
#ifdef BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
std::streamsize precision = std::cout.precision(std::numeric_limits<T>::max_digits10); // Save.
@@ -676,7 +668,7 @@ z * (2.154990206091088289321708745358647e6L // z^20 distance -5 without term 20
std::cout.precision(precision); // Restore.
#endif // BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
return result;
} // long double lambert_w0_small_z(const T z, boost::integral_constant<int, 1> const&)
} // long double lambert_w0_small_z(const T z, std::integral_constant<int, 1> const&)
//! Specialization of 128-bit long double series expansion used for small z (abs(z) < 0.05).
// 34 Taylor series coefficients used are computed by Wolfram to 50 decimal digits using instruction
@@ -686,8 +678,8 @@ z * (2.154990206091088289321708745358647e6L // z^20 distance -5 without term 20
// nor multiprecision type cpp_bin_float_quad that can only be initialised at full precision of the type
// constructed with a decimal digit string like "2.6666666666666666666666666666666666666666666666667".)
template <class T, class Policy>
T lambert_w0_small_z(const T z, const Policy&, boost::integral_constant<int, 3> const&)
template <typename T, typename Policy>
T lambert_w0_small_z(const T z, const Policy&, std::integral_constant<int, 3> const&)
{
#ifdef BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
std::streamsize precision = std::cout.precision(std::numeric_limits<T>::max_digits10); // Save.
@@ -719,7 +711,7 @@ T lambert_w0_small_z(const T z, const Policy&, boost::integral_constant<int, 3>
std::cout.precision(precision); // Restore.
#endif // BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
return result;
} // T lambert_w0_small_z(const T z, boost::integral_constant<int, 3> const&)
} // T lambert_w0_small_z(const T z, std::integral_constant<int, 3> const&)
//! Specialization of 128-bit quad series expansion used for small z (abs(z) < 0.05).
// 34 Taylor series coefficients used were computed by Wolfram to 50 decimal digits using instruction
@@ -732,8 +724,8 @@ T lambert_w0_small_z(const T z, const Policy&, boost::integral_constant<int, 3>
// it is slightly slower than getting a double approximation followed by a single Halley step.
#ifdef BOOST_HAS_FLOAT128
template <class T, class Policy>
T lambert_w0_small_z(const T z, const Policy&, boost::integral_constant<int, 4> const&)
template <typename T, typename Policy>
T lambert_w0_small_z(const T z, const Policy&, std::integral_constant<int, 4> const&)
{
#ifdef BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
std::streamsize precision = std::cout.precision(std::numeric_limits<T>::max_digits10); // Save.
@@ -784,24 +776,24 @@ T lambert_w0_small_z(const T z, const Policy&, boost::integral_constant<int, 4>
#endif // BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
return result;
} // T lambert_w0_small_z(const T z, boost::integral_constant<int, 4> const&) float128
} // T lambert_w0_small_z(const T z, std::integral_constant<int, 4> const&) float128
#else
template <class T, class Policy>
inline T lambert_w0_small_z(const T z, const Policy& pol, boost::integral_constant<int, 4> const&)
template <typename T, typename Policy>
inline T lambert_w0_small_z(const T z, const Policy& pol, std::integral_constant<int, 4> const&)
{
return lambert_w0_small_z(z, pol, boost::integral_constant<int, 5>());
return lambert_w0_small_z(z, pol, std::integral_constant<int, 5>());
}
#endif // BOOST_HAS_FLOAT128
//! Series functor to compute series term using pow and factorial.
//! \details Functor is called after evaluating polynomial with the coefficients as rationals below.
template <class T>
template <typename T>
struct lambert_w0_small_z_series_term
{
typedef T result_type;
using result_type = T;
//! \param _z Lambert W argument z.
//! \param -term -pow<18>(z) / 6402373705728000uLL
//! \param _k number of terms == initially 18
@@ -825,11 +817,11 @@ private:
int k;
T z;
T term;
}; // template <class T> struct lambert_w0_small_z_series_term
}; // template <typename T> struct lambert_w0_small_z_series_term
//! Generic variant for T a User-defined types like Boost.Multiprecision.
template <class T, class Policy>
inline T lambert_w0_small_z(T z, const Policy& pol, boost::integral_constant<int, 5> const&)
template <typename T, typename Policy>
inline T lambert_w0_small_z(T z, const Policy& pol, std::integral_constant<int, 5> const&)
{
#ifdef BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
std::streamsize precision = std::cout.precision(std::numeric_limits<T>::max_digits10); // Save.
@@ -913,7 +905,7 @@ inline T lambert_w0_small_z(T z, const Policy& pol, boost::integral_constant<int
// std::streamsize prec = std::cout.precision(std::numeric_limits <T>::max_digits10);
T result = evaluate_polynomial(coeff, z);
// template <std::size_t N, class T, class V>
// template <std::size_t N, typename T, typename V>
// V evaluate_polynomial(const T(&poly)[N], const V& val);
// Size of coeff found from N
//std::cout << "evaluate_polynomial(coeff, z); == " << result << std::endl;
@@ -942,7 +934,7 @@ inline T lambert_w0_small_z(T z, const Policy& pol, boost::integral_constant<int
//}
//std::cout.precision(saved_precision);
boost::uintmax_t max_iter = policies::get_max_series_iterations<Policy>(); // Max iterations from policy.
std::uintmax_t max_iter = policies::get_max_series_iterations<Policy>(); // Max iterations from policy.
#ifdef BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES
std::cout << "max iter from policy = " << max_iter << std::endl;
// // max iter from policy = 1000000 is default.
@@ -950,7 +942,7 @@ inline T lambert_w0_small_z(T z, const Policy& pol, boost::integral_constant<int
result = sum_series(s, get_epsilon<T, Policy>(), max_iter, result);
// result == evaluate_polynomial.
//sum_series(Functor& func, int bits, boost::uintmax_t& max_terms, const U& init_value)
//sum_series(Functor& func, int bits, std::uintmax_t& max_terms, const U& init_value)
// std::cout << "sum_series(s, get_epsilon<T, Policy>(), max_iter, result); = " << result << std::endl;
//T epsilon = get_epsilon<T, Policy>();
@@ -965,13 +957,12 @@ inline T lambert_w0_small_z(T z, const Policy& pol, boost::integral_constant<int
std::cout.precision(prec); // Restore.
#endif // BOOST_MATH_INSTRUMENT_LAMBERT_W_SMALL_Z_SERIES_ITERATIONS
return result;
} // template <class T, class Policy> inline T lambert_w0_small_z_series(T z, const Policy& pol)
} // template <typename T, typename Policy> inline T lambert_w0_small_z_series(T z, const Policy& pol)
// Approximate lambert_w0 (used for z values that are outside range of lookup table or rational functions)
// Corless equation 4.19, page 349, and Chapeau-Blondeau equation 20, page 2162.
template <typename T>
inline
T lambert_w0_approx(T z)
inline T lambert_w0_approx(T z)
{
BOOST_MATH_STD_USING
T lz = log(z);
@@ -995,7 +986,7 @@ T lambert_w0_approx(T z)
//! For higher precisions, a 64-bit double approximation is computed first,
//! and then refined using Halley iterations.
template <class T>
template <typename T>
inline T do_get_near_singularity_param(T z)
{
BOOST_MATH_STD_USING
@@ -1003,24 +994,24 @@ inline T do_get_near_singularity_param(T z)
const T p = sqrt(p2);
return p;
}
template <class T, class Policy>
template <typename T, typename Policy>
inline T get_near_singularity_param(T z, const Policy)
{
typedef typename policies::evaluation<T, Policy>::type value_type;
using value_type = typename policies::evaluation<T, Policy>::type;
return static_cast<T>(do_get_near_singularity_param(static_cast<value_type>(z)));
}
// Forward declarations:
//template <class T, class Policy> T lambert_w0_small_z(T z, const Policy& pol);
//template <class T, class Policy>
//T lambert_w0_imp(T w, const Policy& pol, const boost::integral_constant<int, 0>&); // 32 bit usually float.
//template <class T, class Policy>
//T lambert_w0_imp(T w, const Policy& pol, const boost::integral_constant<int, 1>&); // 64 bit usually double.
//template <class T, class Policy>
//T lambert_w0_imp(T w, const Policy& pol, const boost::integral_constant<int, 2>&); // 80-bit long double.
//template <typename T, typename Policy> T lambert_w0_small_z(T z, const Policy& pol);
//template <typename T, typename Policy>
//T lambert_w0_imp(T w, const Policy& pol, const std::integral_constant<int, 0>&); // 32 bit usually float.
//template <typename T, typename Policy>
//T lambert_w0_imp(T w, const Policy& pol, const std::integral_constant<int, 1>&); // 64 bit usually double.
//template <typename T, typename Policy>
//T lambert_w0_imp(T w, const Policy& pol, const std::integral_constant<int, 2>&); // 80-bit long double.
template <class T>
template <typename T>
T lambert_w_positive_rational_float(T z)
{
BOOST_MATH_STD_USING
@@ -1164,7 +1155,7 @@ T lambert_w_positive_rational_float(T z)
}
}
template <class T, class Policy>
template <typename T, typename Policy>
T lambert_w_negative_rational_float(T z, const Policy& pol)
{
BOOST_MATH_STD_USING
@@ -1223,8 +1214,8 @@ T lambert_w_negative_rational_float(T z, const Policy& pol)
}
//! Lambert_w0 @b 'float' implementation, selected when T is 32-bit precision.
template <class T, class Policy>
inline T lambert_w0_imp(T z, const Policy& pol, const boost::integral_constant<int, 1>&)
template <typename T, typename Policy>
inline T lambert_w0_imp(T z, const Policy& pol, const std::integral_constant<int, 1>&)
{
static const char* function = "boost::math::lambert_w0<%1%>"; // For error messages.
BOOST_MATH_STD_USING // Aid ADL of std functions.
@@ -1253,9 +1244,9 @@ inline T lambert_w0_imp(T z, const Policy& pol, const boost::integral_constant<i
{
return lambert_w_negative_rational_float(z, pol);
}
} // T lambert_w0_imp(T z, const Policy& pol, const boost::integral_constant<int, 1>&) for 32-bit usually float.
} // T lambert_w0_imp(T z, const Policy& pol, const std::integral_constant<int, 1>&) for 32-bit usually float.
template <class T>
template <typename T>
T lambert_w_positive_rational_double(T z)
{
BOOST_MATH_STD_USING
@@ -1491,7 +1482,7 @@ T lambert_w_positive_rational_double(T z)
}
}
template <class T, class Policy>
template <typename T, typename Policy>
T lambert_w_negative_rational_double(T z, const Policy& pol)
{
BOOST_MATH_STD_USING
@@ -1622,8 +1613,8 @@ T lambert_w_negative_rational_double(T z, const Policy& pol)
}
//! Lambert_w0 @b 'double' implementation, selected when T is 64-bit precision.
template <class T, class Policy>
inline T lambert_w0_imp(T z, const Policy& pol, const boost::integral_constant<int, 2>&)
template <typename T, typename Policy>
inline T lambert_w0_imp(T z, const Policy& pol, const std::integral_constant<int, 2>&)
{
static const char* function = "boost::math::lambert_w0<%1%>";
BOOST_MATH_STD_USING // Aid ADL of std functions.
@@ -1660,14 +1651,14 @@ inline T lambert_w0_imp(T z, const Policy& pol, const boost::integral_constant<i
{
return lambert_w_negative_rational_double(z, pol);
}
} // T lambert_w0_imp(T z, const Policy& pol, const boost::integral_constant<int, 2>&) 64-bit precision, usually double.
} // T lambert_w0_imp(T z, const Policy& pol, const std::integral_constant<int, 2>&) 64-bit precision, usually double.
//! lambert_W0 implementation for extended precision types including
//! long double (80-bit and 128-bit), ???
//! quad float128, Boost.Multiprecision types like cpp_bin_float_quad, cpp_bin_float_50...
template <class T, class Policy>
inline T lambert_w0_imp(T z, const Policy& pol, const boost::integral_constant<int, 0>&)
template <typename T, typename Policy>
inline T lambert_w0_imp(T z, const Policy& pol, const std::integral_constant<int, 0>&)
{
static const char* function = "boost::math::lambert_w0<%1%>";
BOOST_MATH_STD_USING // Aid ADL of std functions.
@@ -1723,27 +1714,27 @@ inline T lambert_w0_imp(T z, const Policy& pol, const boost::integral_constant<i
// true_type if there are so many digits precision wanted that iteration is necessary.
// false_type if a single Halley step is sufficient.
typedef typename policies::precision<T, Policy>::type precision_type;
typedef boost::integral_constant<bool,
using precision_type = typename policies::precision<T, Policy>::type;
using tag_type = std::integral_constant<bool,
(precision_type::value == 0) || (precision_type::value > 113) ?
true // Unknown at compile-time, variable/arbitrary, or more than float128 or cpp_bin_quad 128-bit precision.
: false // float, double, float128, cpp_bin_quad 128-bit, so single Halley step.
> tag_type;
>;
// For speed, we also cast z to type double when that is possible
// if (boost::is_constructible<double, T>() == true).
T w = lambert_w0_imp(maybe_reduce_to_double(z, boost::is_constructible<double, T>()), pol, boost::integral_constant<int, 2>());
// if (std::is_constructible<double, T>() == true).
T w = lambert_w0_imp(maybe_reduce_to_double(z, std::is_constructible<double, T>()), pol, std::integral_constant<int, 2>());
return lambert_w_maybe_halley_iterate(w, z, tag_type());
} // T lambert_w0_imp(T z, const Policy& pol, const boost::integral_constant<int, 0>&) all extended precision types.
} // T lambert_w0_imp(T z, const Policy& pol, const std::integral_constant<int, 0>&) all extended precision types.
// Lambert w-1 implementation
// ==============================================================================================
//! Lambert W for W-1 branch, -max(z) < z <= -1/e.
// TODO is -max(z) allowed?
template<typename T, class Policy>
template<typename T, typename Policy>
T lambert_wm1_imp(const T z, const Policy& pol)
{
// Catch providing an integer value as parameter x to lambert_w, for example, lambert_w(1).
@@ -1919,7 +1910,7 @@ T lambert_wm1_imp(const T z, const Policy& pol)
using boost::math::policies::digits2;
using boost::math::policies::policy;
// Compute a 50-bit precision approximate W0 in a double (no Halley refinement).
T double_approx(static_cast<T>(lambert_wm1_imp(must_reduce_to_double(z, boost::is_constructible<double, T>()), policy<digits2<50> >())));
T double_approx(static_cast<T>(lambert_wm1_imp(must_reduce_to_double(z, std::is_constructible<double, T>()), policy<digits2<50>>())));
#ifdef BOOST_MATH_INSTRUMENT_LAMBERT_WM1_NOT_BUILTIN
std::streamsize saved_precision = std::cout.precision(std::numeric_limits<T>::max_digits10);
std::cout << "Lambert_wm1 Argument Type " << typeid(T).name() << " approximation double = " << double_approx << std::endl;
@@ -2009,7 +2000,7 @@ T lambert_wm1_imp(const T z, const Policy& pol)
using lambert_w_lookup::halves;
using lambert_w_lookup::sqrtwm1s;
typedef typename mpl::if_c<boost::is_constructible<lookup_t, T>::value, lookup_t, T>::type calc_type;
using calc_type = typename std::conditional<std::is_constructible<lookup_t, T>::value, lookup_t, T>::type;
calc_type w = -static_cast<calc_type>(n); // Equation 25,
calc_type y = static_cast<calc_type>(z * wm1es[n - 1]); // Equation 26,
@@ -2045,82 +2036,82 @@ T lambert_wm1_imp(const T z, const Policy& pol)
///////////////////////////// User Lambert w functions. //////////////////////////////
//! Lambert W0 using User-defined policy.
template <class T, class Policy>
template <typename T, typename Policy>
inline
typename boost::math::tools::promote_args<T>::type
lambert_w0(T z, const Policy& pol)
{
// Promote integer or expression template arguments to double,
// without doing any other internal promotion like float to double.
typedef typename tools::promote_args<T>::type result_type;
using result_type = typename tools::promote_args<T>::type;
// Work out what precision has been selected,
// based on the Policy and the number type.
typedef typename policies::precision<result_type, Policy>::type precision_type;
using precision_type = typename policies::precision<result_type, Policy>::type;
// and then select the correct implementation based on that precision (not the type T):
typedef boost::integral_constant<int,
using tag_type = std::integral_constant<int,
(precision_type::value == 0) || (precision_type::value > 53) ?
0 // either variable precision (0), or greater than 64-bit precision.
: (precision_type::value <= 24) ? 1 // 32-bit (probably float) precision.
: 2 // 64-bit (probably double) precision.
> tag_type;
>;
return lambert_w_detail::lambert_w0_imp(result_type(z), pol, tag_type()); //
} // lambert_w0(T z, const Policy& pol)
//! Lambert W0 using default policy.
template <class T>
template <typename T>
inline
typename tools::promote_args<T>::type
lambert_w0(T z)
{
// Promote integer or expression template arguments to double,
// without doing any other internal promotion like float to double.
typedef typename tools::promote_args<T>::type result_type;
using result_type = typename tools::promote_args<T>::type;
// Work out what precision has been selected, based on the Policy and the number type.
// For the default policy version, we want the *default policy* precision for T.
typedef typename policies::precision<result_type, policies::policy<> >::type precision_type;
using precision_type = typename policies::precision<result_type, policies::policy<>>::type;
// and then select the correct implementation based on that (not the type T):
typedef boost::integral_constant<int,
using tag_type = std::integral_constant<int,
(precision_type::value == 0) || (precision_type::value > 53) ?
0 // either variable precision (0), or greater than 64-bit precision.
: (precision_type::value <= 24) ? 1 // 32-bit (probably float) precision.
: 2 // 64-bit (probably double) precision.
> tag_type;
>;
return lambert_w_detail::lambert_w0_imp(result_type(z), policies::policy<>(), tag_type());
} // lambert_w0(T z) using default policy.
//! W-1 branch (-max(z) < z <= -1/e).
//! Lambert W-1 using User-defined policy.
template <class T, class Policy>
template <typename T, typename Policy>
inline
typename tools::promote_args<T>::type
lambert_wm1(T z, const Policy& pol)
{
// Promote integer or expression template arguments to double,
// without doing any other internal promotion like float to double.
typedef typename tools::promote_args<T>::type result_type;
using result_type = typename tools::promote_args<T>::type;
return lambert_w_detail::lambert_wm1_imp(result_type(z), pol); //
}
//! Lambert W-1 using default policy.
template <class T>
template <typename T>
inline
typename tools::promote_args<T>::type
lambert_wm1(T z)
{
typedef typename tools::promote_args<T>::type result_type;
using result_type = typename tools::promote_args<T>::type;
return lambert_w_detail::lambert_wm1_imp(result_type(z), policies::policy<>());
} // lambert_wm1(T z)
// First derivative of Lambert W0 and W-1.
template <class T, class Policy>
template <typename T, typename Policy>
inline typename tools::promote_args<T>::type
lambert_w0_prime(T z, const Policy& pol)
{
typedef typename tools::promote_args<T>::type result_type;
using result_type = typename tools::promote_args<T>::type;
using std::numeric_limits;
if (z == 0)
{
@@ -2144,19 +2135,19 @@ T lambert_wm1_imp(const T z, const Policy& pol)
return w / (z * (1 + w));
} // lambert_w0_prime(T z)
template <class T>
template <typename T>
inline typename tools::promote_args<T>::type
lambert_w0_prime(T z)
{
return lambert_w0_prime(z, policies::policy<>());
}
template <class T, class Policy>
template <typename T, typename Policy>
inline typename tools::promote_args<T>::type
lambert_wm1_prime(T z, const Policy& pol)
{
using std::numeric_limits;
typedef typename tools::promote_args<T>::type result_type;
using result_type = typename tools::promote_args<T>::type;
//if (z == 0)
//{
// return static_cast<result_type>(1);
@@ -2171,7 +2162,7 @@ T lambert_wm1_imp(const T z, const Policy& pol)
return w/(z*(1+w));
} // lambert_wm1_prime(T z)
template <class T>
template <typename T>
inline typename tools::promote_args<T>::type
lambert_wm1_prime(T z)
{

View File

@@ -12,14 +12,11 @@
#include <boost/config.hpp>
#include <boost/math/tools/big_constant.hpp>
#include <boost/mpl/if.hpp>
#include <boost/limits.hpp>
#include <boost/cstdint.hpp>
#include <boost/math/tools/rational.hpp>
#include <boost/math/policies/policy.hpp>
#include <boost/mpl/less_equal.hpp>
#include <limits.h>
#include <limits>
#include <type_traits>
#include <cstdint>
#if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128)
//
@@ -77,7 +74,7 @@ typename lanczos_initializer<Lanczos, T>::init const lanczos_initializer<Lanczos
// Max experimental error (with arbitrary precision arithmetic) 9.516e-12
// Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006
//
struct lanczos6 : public boost::integral_constant<int, 35>
struct lanczos6 : public std::integral_constant<int, 35>
{
//
// Produces slightly better than float precision when evaluated at
@@ -95,13 +92,13 @@ struct lanczos6 : public boost::integral_constant<int, 35>
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, 63.99951844938187085666201263218840287667)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, 2.506628274631006311133031631822390264407))
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint16_t) denom[6] = {
static_cast<boost::uint16_t>(0u),
static_cast<boost::uint16_t>(24u),
static_cast<boost::uint16_t>(50u),
static_cast<boost::uint16_t>(35u),
static_cast<boost::uint16_t>(10u),
static_cast<boost::uint16_t>(1u)
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = {
static_cast<std::uint16_t>(0u),
static_cast<std::uint16_t>(24u),
static_cast<std::uint16_t>(50u),
static_cast<std::uint16_t>(35u),
static_cast<std::uint16_t>(10u),
static_cast<std::uint16_t>(1u)
};
return boost::math::tools::evaluate_rational(num, denom, z);
}
@@ -118,13 +115,13 @@ struct lanczos6 : public boost::integral_constant<int, 35>
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, 0.2412010548258800231126240760264822486599)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 35, 0.009446967704539249494420221613134244048319))
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint16_t) denom[6] = {
static_cast<boost::uint16_t>(0u),
static_cast<boost::uint16_t>(24u),
static_cast<boost::uint16_t>(50u),
static_cast<boost::uint16_t>(35u),
static_cast<boost::uint16_t>(10u),
static_cast<boost::uint16_t>(1u)
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = {
static_cast<std::uint16_t>(0u),
static_cast<std::uint16_t>(24u),
static_cast<std::uint16_t>(50u),
static_cast<std::uint16_t>(35u),
static_cast<std::uint16_t>(10u),
static_cast<std::uint16_t>(1u)
};
return boost::math::tools::evaluate_rational(num, denom, z);
}
@@ -177,7 +174,7 @@ struct lanczos6 : public boost::integral_constant<int, 35>
// Max experimental error (with arbitrary precision arithmetic) 2.16676e-19
// Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006
//
struct lanczos11 : public boost::integral_constant<int, 60>
struct lanczos11 : public std::integral_constant<int, 60>
{
//
// Produces slightly better than double precision when evaluated at
@@ -200,18 +197,18 @@ struct lanczos11 : public boost::integral_constant<int, 60>
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, 261.6140441641668190791708576058805625502)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, 2.506628274631000502415573855452633787834))
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[11] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(362880u),
static_cast<boost::uint32_t>(1026576u),
static_cast<boost::uint32_t>(1172700u),
static_cast<boost::uint32_t>(723680u),
static_cast<boost::uint32_t>(269325u),
static_cast<boost::uint32_t>(63273u),
static_cast<boost::uint32_t>(9450u),
static_cast<boost::uint32_t>(870u),
static_cast<boost::uint32_t>(45u),
static_cast<boost::uint32_t>(1u)
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[11] = {
static_cast<std::uint32_t>(0u),
static_cast<std::uint32_t>(362880u),
static_cast<std::uint32_t>(1026576u),
static_cast<std::uint32_t>(1172700u),
static_cast<std::uint32_t>(723680u),
static_cast<std::uint32_t>(269325u),
static_cast<std::uint32_t>(63273u),
static_cast<std::uint32_t>(9450u),
static_cast<std::uint32_t>(870u),
static_cast<std::uint32_t>(45u),
static_cast<std::uint32_t>(1u)
};
return boost::math::tools::evaluate_rational(num, denom, z);
}
@@ -233,18 +230,18 @@ struct lanczos11 : public boost::integral_constant<int, 60>
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, 0.004826466289237661857584712046231435101741)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 60, 0.4624429436045378766270459638520555557321e-4))
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[11] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(362880u),
static_cast<boost::uint32_t>(1026576u),
static_cast<boost::uint32_t>(1172700u),
static_cast<boost::uint32_t>(723680u),
static_cast<boost::uint32_t>(269325u),
static_cast<boost::uint32_t>(63273u),
static_cast<boost::uint32_t>(9450u),
static_cast<boost::uint32_t>(870u),
static_cast<boost::uint32_t>(45u),
static_cast<boost::uint32_t>(1u)
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[11] = {
static_cast<std::uint32_t>(0u),
static_cast<std::uint32_t>(362880u),
static_cast<std::uint32_t>(1026576u),
static_cast<std::uint32_t>(1172700u),
static_cast<std::uint32_t>(723680u),
static_cast<std::uint32_t>(269325u),
static_cast<std::uint32_t>(63273u),
static_cast<std::uint32_t>(9450u),
static_cast<std::uint32_t>(870u),
static_cast<std::uint32_t>(45u),
static_cast<std::uint32_t>(1u)
};
return boost::math::tools::evaluate_rational(num, denom, z);
}
@@ -307,7 +304,7 @@ struct lanczos11 : public boost::integral_constant<int, 60>
// Max experimental error (with arbitrary precision arithmetic) 9.2213e-23
// Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006
//
struct lanczos13 : public boost::integral_constant<int, 72>
struct lanczos13 : public std::integral_constant<int, 72>
{
//
// Produces slightly better than extended-double precision when evaluated at
@@ -332,20 +329,20 @@ struct lanczos13 : public boost::integral_constant<int, 72>
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, 381.8801248632926870394389468349331394196)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, 2.506628274631000502415763426076722427007))
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[13] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(39916800u),
static_cast<boost::uint32_t>(120543840u),
static_cast<boost::uint32_t>(150917976u),
static_cast<boost::uint32_t>(105258076u),
static_cast<boost::uint32_t>(45995730u),
static_cast<boost::uint32_t>(13339535u),
static_cast<boost::uint32_t>(2637558u),
static_cast<boost::uint32_t>(357423u),
static_cast<boost::uint32_t>(32670u),
static_cast<boost::uint32_t>(1925u),
static_cast<boost::uint32_t>(66u),
static_cast<boost::uint32_t>(1u)
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = {
static_cast<std::uint32_t>(0u),
static_cast<std::uint32_t>(39916800u),
static_cast<std::uint32_t>(120543840u),
static_cast<std::uint32_t>(150917976u),
static_cast<std::uint32_t>(105258076u),
static_cast<std::uint32_t>(45995730u),
static_cast<std::uint32_t>(13339535u),
static_cast<std::uint32_t>(2637558u),
static_cast<std::uint32_t>(357423u),
static_cast<std::uint32_t>(32670u),
static_cast<std::uint32_t>(1925u),
static_cast<std::uint32_t>(66u),
static_cast<std::uint32_t>(1u)
};
return boost::math::tools::evaluate_rational(num, denom, z);
}
@@ -369,20 +366,20 @@ struct lanczos13 : public boost::integral_constant<int, 72>
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, 0.0007469903808915448316510079585999893674101)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 72, 0.4903180573459871862552197089738373164184e-5))
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[13] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(39916800u),
static_cast<boost::uint32_t>(120543840u),
static_cast<boost::uint32_t>(150917976u),
static_cast<boost::uint32_t>(105258076u),
static_cast<boost::uint32_t>(45995730u),
static_cast<boost::uint32_t>(13339535u),
static_cast<boost::uint32_t>(2637558u),
static_cast<boost::uint32_t>(357423u),
static_cast<boost::uint32_t>(32670u),
static_cast<boost::uint32_t>(1925u),
static_cast<boost::uint32_t>(66u),
static_cast<boost::uint32_t>(1u)
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = {
static_cast<std::uint32_t>(0u),
static_cast<std::uint32_t>(39916800u),
static_cast<std::uint32_t>(120543840u),
static_cast<std::uint32_t>(150917976u),
static_cast<std::uint32_t>(105258076u),
static_cast<std::uint32_t>(45995730u),
static_cast<std::uint32_t>(13339535u),
static_cast<std::uint32_t>(2637558u),
static_cast<std::uint32_t>(357423u),
static_cast<std::uint32_t>(32670u),
static_cast<std::uint32_t>(1925u),
static_cast<std::uint32_t>(66u),
static_cast<std::uint32_t>(1u)
};
return boost::math::tools::evaluate_rational(num, denom, z);
}
@@ -449,7 +446,7 @@ struct lanczos13 : public boost::integral_constant<int, 72>
// Max experimental error (with arbitrary precision arithmetic) 2.9524e-38
// Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006
//
struct lanczos22 : public boost::integral_constant<int, 120>
struct lanczos22 : public std::integral_constant<int, 120>
{
//
// Produces slightly better than 128-bit long-double precision when
@@ -483,7 +480,7 @@ struct lanczos22 : public boost::integral_constant<int, 120>
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 1167.501919472435718934219997431551246996)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 2.50662827463100050241576528481104525333))
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint64_t) denom[22] = {
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint64_t) denom[22] = {
BOOST_MATH_INT_VALUE_SUFFIX(0, uLL),
BOOST_MATH_INT_VALUE_SUFFIX(2432902008176640000, uLL),
BOOST_MATH_INT_VALUE_SUFFIX(8752948036761600000, uLL),
@@ -538,7 +535,7 @@ struct lanczos22 : public boost::integral_constant<int, 120>
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 0.1753839324538447655939518484052327068859e-6)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 120, 0.3765495513732730583386223384116545391759e-9))
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint64_t) denom[22] = {
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint64_t) denom[22] = {
BOOST_MATH_INT_VALUE_SUFFIX(0, uLL),
BOOST_MATH_INT_VALUE_SUFFIX(2432902008176640000, uLL),
BOOST_MATH_INT_VALUE_SUFFIX(8752948036761600000, uLL),
@@ -645,7 +642,7 @@ struct lanczos22 : public boost::integral_constant<int, 120>
// Max experimental error (with arbitrary precision arithmetic) 8.111667e-8
// Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006
//
struct lanczos6m24 : public boost::integral_constant<int, 24>
struct lanczos6m24 : public std::integral_constant<int, 24>
{
//
// Use for float precision, when evaluated as a float:
@@ -661,13 +658,13 @@ struct lanczos6m24 : public boost::integral_constant<int, 24>
static_cast<T>(27.5192015197455403062503721613097825345L),
static_cast<T>(2.50662858515256974113978724717473206342L)
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint16_t) denom[6] = {
static_cast<boost::uint16_t>(0u),
static_cast<boost::uint16_t>(24u),
static_cast<boost::uint16_t>(50u),
static_cast<boost::uint16_t>(35u),
static_cast<boost::uint16_t>(10u),
static_cast<boost::uint16_t>(1u)
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = {
static_cast<std::uint16_t>(0u),
static_cast<std::uint16_t>(24u),
static_cast<std::uint16_t>(50u),
static_cast<std::uint16_t>(35u),
static_cast<std::uint16_t>(10u),
static_cast<std::uint16_t>(1u)
};
return boost::math::tools::evaluate_rational(num, denom, z);
}
@@ -683,13 +680,13 @@ struct lanczos6m24 : public boost::integral_constant<int, 24>
static_cast<T>(6.595765571169314946316366571954421695196L),
static_cast<T>(0.6007854010515290065101128585795542383721L)
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint16_t) denom[6] = {
static_cast<boost::uint16_t>(0u),
static_cast<boost::uint16_t>(24u),
static_cast<boost::uint16_t>(50u),
static_cast<boost::uint16_t>(35u),
static_cast<boost::uint16_t>(10u),
static_cast<boost::uint16_t>(1u)
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint16_t) denom[6] = {
static_cast<std::uint16_t>(0u),
static_cast<std::uint16_t>(24u),
static_cast<std::uint16_t>(50u),
static_cast<std::uint16_t>(35u),
static_cast<std::uint16_t>(10u),
static_cast<std::uint16_t>(1u)
};
return boost::math::tools::evaluate_rational(num, denom, z);
}
@@ -740,7 +737,7 @@ struct lanczos6m24 : public boost::integral_constant<int, 24>
// Max experimental error (with arbitrary precision arithmetic) 1.196214e-17
// Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006
//
struct lanczos13m53 : public boost::integral_constant<int, 53>
struct lanczos13m53 : public std::integral_constant<int, 53>
{
//
// Use for double precision, when evaluated as a double:
@@ -763,20 +760,20 @@ struct lanczos13m53 : public boost::integral_constant<int, 53>
static_cast<T>(210.8242777515793458725097339207133627117L),
static_cast<T>(2.506628274631000270164908177133837338626L)
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[13] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(39916800u),
static_cast<boost::uint32_t>(120543840u),
static_cast<boost::uint32_t>(150917976u),
static_cast<boost::uint32_t>(105258076u),
static_cast<boost::uint32_t>(45995730u),
static_cast<boost::uint32_t>(13339535u),
static_cast<boost::uint32_t>(2637558u),
static_cast<boost::uint32_t>(357423u),
static_cast<boost::uint32_t>(32670u),
static_cast<boost::uint32_t>(1925u),
static_cast<boost::uint32_t>(66u),
static_cast<boost::uint32_t>(1u)
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = {
static_cast<std::uint32_t>(0u),
static_cast<std::uint32_t>(39916800u),
static_cast<std::uint32_t>(120543840u),
static_cast<std::uint32_t>(150917976u),
static_cast<std::uint32_t>(105258076u),
static_cast<std::uint32_t>(45995730u),
static_cast<std::uint32_t>(13339535u),
static_cast<std::uint32_t>(2637558u),
static_cast<std::uint32_t>(357423u),
static_cast<std::uint32_t>(32670u),
static_cast<std::uint32_t>(1925u),
static_cast<std::uint32_t>(66u),
static_cast<std::uint32_t>(1u)
};
return boost::math::tools::evaluate_rational(num, denom, z);
}
@@ -799,20 +796,20 @@ struct lanczos13m53 : public boost::integral_constant<int, 53>
static_cast<T>(0.5098416655656676188125178644804694509993L),
static_cast<T>(0.006061842346248906525783753964555936883222L)
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint32_t) denom[13] = {
static_cast<boost::uint32_t>(0u),
static_cast<boost::uint32_t>(39916800u),
static_cast<boost::uint32_t>(120543840u),
static_cast<boost::uint32_t>(150917976u),
static_cast<boost::uint32_t>(105258076u),
static_cast<boost::uint32_t>(45995730u),
static_cast<boost::uint32_t>(13339535u),
static_cast<boost::uint32_t>(2637558u),
static_cast<boost::uint32_t>(357423u),
static_cast<boost::uint32_t>(32670u),
static_cast<boost::uint32_t>(1925u),
static_cast<boost::uint32_t>(66u),
static_cast<boost::uint32_t>(1u)
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint32_t) denom[13] = {
static_cast<std::uint32_t>(0u),
static_cast<std::uint32_t>(39916800u),
static_cast<std::uint32_t>(120543840u),
static_cast<std::uint32_t>(150917976u),
static_cast<std::uint32_t>(105258076u),
static_cast<std::uint32_t>(45995730u),
static_cast<std::uint32_t>(13339535u),
static_cast<std::uint32_t>(2637558u),
static_cast<std::uint32_t>(357423u),
static_cast<std::uint32_t>(32670u),
static_cast<std::uint32_t>(1925u),
static_cast<std::uint32_t>(66u),
static_cast<std::uint32_t>(1u)
};
return boost::math::tools::evaluate_rational(num, denom, z);
}
@@ -877,7 +874,7 @@ struct lanczos13m53 : public boost::integral_constant<int, 53>
// Max experimental error (with arbitrary precision arithmetic) 2.7699e-26
// Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006
//
struct lanczos17m64 : public boost::integral_constant<int, 64>
struct lanczos17m64 : public std::integral_constant<int, 64>
{
//
// Use for extended-double precision, when evaluated as an extended-double:
@@ -905,7 +902,7 @@ struct lanczos17m64 : public boost::integral_constant<int, 64>
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 488.0063567520005730476791712814838113252)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 2.50662827463100050241576877135758834683))
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint64_t) denom[17] = {
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint64_t) denom[17] = {
BOOST_MATH_INT_VALUE_SUFFIX(0, uLL),
BOOST_MATH_INT_VALUE_SUFFIX(1307674368000, uLL),
BOOST_MATH_INT_VALUE_SUFFIX(4339163001600, uLL),
@@ -950,7 +947,7 @@ struct lanczos17m64 : public boost::integral_constant<int, 64>
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 0.002393749522058449186690627996063983095463)),
static_cast<T>(BOOST_MATH_BIG_CONSTANT(T, 64, 0.1229541408909435212800785616808830746135e-4))
};
static const BOOST_MATH_INT_TABLE_TYPE(T, boost::uint64_t) denom[17] = {
static const BOOST_MATH_INT_TABLE_TYPE(T, std::uint64_t) denom[17] = {
BOOST_MATH_INT_VALUE_SUFFIX(0, uLL),
BOOST_MATH_INT_VALUE_SUFFIX(1307674368000, uLL),
BOOST_MATH_INT_VALUE_SUFFIX(4339163001600, uLL),
@@ -1042,7 +1039,7 @@ struct lanczos17m64 : public boost::integral_constant<int, 64>
// Max experimental error (with arbitrary precision arithmetic) 1.0541e-38
// Generated with compiler: Microsoft Visual C++ version 8.0 on Win32 at Mar 23 2006
//
struct lanczos24m113 : public boost::integral_constant<int, 113>
struct lanczos24m113 : public std::integral_constant<int, 113>
{
//
// Use for long-double precision, when evaluated as an long-double:
@@ -1250,7 +1247,7 @@ struct lanczos24m113 : public boost::integral_constant<int, 113>
// Generated with compiler: Microsoft Visual C++ version 14.2 on Win32 at Oct 14 2019
// Type precision was 134 bits or 43 max_digits10
//
struct lanczos32MP : public boost::integral_constant<int, 134>
struct lanczos32MP : public std::integral_constant<int, 134>
{
template <class T>
static T lanczos_sum(const T& z)
@@ -1499,7 +1496,7 @@ struct lanczos32MP : public boost::integral_constant<int, 134>
// Generated with compiler: Microsoft Visual C++ version 14.2 on Win32 at Oct 14 2019
// Type precision was 168 bits or 53 max_digits10
//
struct lanczos35MP : public boost::integral_constant<int, 168>
struct lanczos35MP : public std::integral_constant<int, 168>
{
template <class T>
static T lanczos_sum(const T& z)
@@ -1766,7 +1763,7 @@ struct lanczos35MP : public boost::integral_constant<int, 168>
// Generated with compiler: Microsoft Visual C++ version 14.2 on Win32 at Oct 14 2019
// Type precision was 201 bits or 63 max_digits10
//
struct lanczos48MP : public boost::integral_constant<int, 201>
struct lanczos48MP : public std::integral_constant<int, 201>
{
template <class T>
static T lanczos_sum(const T& z)
@@ -2110,7 +2107,7 @@ struct lanczos48MP : public boost::integral_constant<int, 201>
// Generated with compiler: Microsoft Visual C++ version 14.2 on Win32 at Oct 14 2019
// Type precision was 234 bits or 73 max_digits10
//
struct lanczos49MP : public boost::integral_constant<int, 234>
struct lanczos49MP : public std::integral_constant<int, 234>
{
template <class T>
static T lanczos_sum(const T& z)
@@ -2460,7 +2457,7 @@ struct lanczos49MP : public boost::integral_constant<int, 234>
// Generated with compiler: Microsoft Visual C++ version 14.2 on Win32 at Oct 14 2019
// Type precision was 267 bits or 83 max_digits10
//
struct lanczos49MP_2 : public boost::integral_constant<int, 267>
struct lanczos49MP_2 : public std::integral_constant<int, 267>
{
template <class T>
static T lanczos_sum(const T& z)
@@ -2810,7 +2807,7 @@ struct lanczos49MP_2 : public boost::integral_constant<int, 267>
// Generated with compiler: Microsoft Visual C++ version 14.2 on Win32 at Oct 14 2019
// Type precision was 334 bits or 103 max_digits10
//
struct lanczos58MP : public boost::integral_constant<int, 334>
struct lanczos58MP : public std::integral_constant<int, 334>
{
template <class T>
static T lanczos_sum(const T& z)
@@ -3213,7 +3210,7 @@ struct lanczos58MP : public boost::integral_constant<int, 334>
//
// placeholder for no lanczos info available:
//
struct undefined_lanczos : public boost::integral_constant<int, INT_MAX - 1> { };
struct undefined_lanczos : public std::integral_constant<int, (std::numeric_limits<int>::max)() - 1> { };
#if 0
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
@@ -3227,37 +3224,26 @@ struct undefined_lanczos : public boost::integral_constant<int, INT_MAX - 1> { }
#endif
#endif
typedef mpl::list<
lanczos6m24,
/* lanczos6, */
lanczos13m53,
/* lanczos13, */
lanczos17m64,
lanczos24m113,
lanczos22,
lanczos32MP,
lanczos35MP,
lanczos48MP,
lanczos49MP,
lanczos49MP_2,
lanczos58MP,
undefined_lanczos> lanczos_list;
template <class Real, class Policy>
struct lanczos
{
typedef typename mpl::if_<
typename mpl::less_equal<
typename policies::precision<Real, Policy>::type,
boost::integral_constant<int, 0>
>::type,
boost::integral_constant<int, INT_MAX - 2>,
typename policies::precision<Real, Policy>::type
>::type target_precision;
static constexpr auto target_precision = policies::precision<Real, Policy>::type::value <= 0 ? (std::numeric_limits<int>::max)()-2 :
policies::precision<Real, Policy>::type::value;
typedef typename mpl::deref<typename mpl::find_if<
lanczos_list,
mpl::less_equal<target_precision, mpl::_1> >::type>::type type;
using type = typename std::conditional<(target_precision <= lanczos6m24::value), lanczos6m24,
typename std::conditional<(target_precision <= lanczos13m53::value), lanczos13m53,
typename std::conditional<(target_precision <= lanczos11::value), lanczos11,
typename std::conditional<(target_precision <= lanczos17m64::value), lanczos17m64,
typename std::conditional<(target_precision <= lanczos24m113::value), lanczos24m113,
typename std::conditional<(target_precision <= lanczos22::value), lanczos22,
typename std::conditional<(target_precision <= lanczos32MP::value), lanczos32MP,
typename std::conditional<(target_precision <= lanczos35MP::value), lanczos35MP,
typename std::conditional<(target_precision <= lanczos48MP::value), lanczos48MP,
typename std::conditional<(target_precision <= lanczos49MP::value), lanczos49MP,
typename std::conditional<(target_precision <= lanczos49MP_2::value), lanczos49MP_2,
typename std::conditional<(target_precision <= lanczos58MP::value), lanczos58MP, undefined_lanczos>::type
>::type>::type>::type>::type>::type>::type>::type>::type>::type>::type
>::type;
};
} // namespace lanczos

View File

@@ -17,7 +17,6 @@
#include <boost/math/policies/policy.hpp>
#include <boost/math/policies/error_handling.hpp>
#include <boost/math/tools/promotion.hpp>
#include <boost/mpl/greater_equal.hpp>
namespace boost {
@@ -113,12 +112,7 @@ struct power_if_positive<0, true>
template <int N>
struct select_power_if_positive
{
typedef typename mpl::greater_equal<
boost::integral_constant<int, N>,
boost::integral_constant<int, 0>
>::type is_positive;
typedef power_if_positive<N, is_positive::value> type;
using type = power_if_positive<N, (N >= 0)>;
};
@@ -128,7 +122,7 @@ struct select_power_if_positive
template <int N, typename T, class Policy>
BOOST_CXX14_CONSTEXPR inline typename tools::promote_args<T>::type pow(T base, const Policy& policy)
{
typedef typename tools::promote_args<T>::type result_type;
using result_type = typename tools::promote_args<T>::type;
return detail::select_power_if_positive<N>::type::result(static_cast<result_type>(base), policy);
}

View File

@@ -16,7 +16,6 @@
#include <boost/math/tools/promotion.hpp>
#include <boost/math/policies/error_handling.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/mpl/comparison.hpp>
#include <boost/math/tools/big_constant.hpp>
#include <boost/math/special_functions/polygamma.hpp>

View File

@@ -13,14 +13,13 @@
#include <boost/limits.hpp>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/math/policies/policy.hpp>
// These two are for LDBL_MAN_DIG:
#include <limits.h>
#include <math.h>
#include <type_traits>
#include <limits>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cfloat> // LDBL_MANT_DIG
namespace boost{ namespace math
{
@@ -188,7 +187,7 @@ inline T epsilon(const boost::false_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TY
template <class T>
struct log_limit_traits
{
typedef typename mpl::if_c<
typedef typename std::conditional<
(std::numeric_limits<T>::radix == 2) &&
(std::numeric_limits<T>::max_exponent == 128
|| std::numeric_limits<T>::max_exponent == 1024

View File

@@ -22,18 +22,8 @@
#pragma once
#endif
// Boost type traits:
#include <boost/math/tools/config.hpp>
#include <boost/type_traits/is_floating_point.hpp> // for boost::is_floating_point;
#include <boost/type_traits/is_integral.hpp> // for boost::is_integral
#include <boost/type_traits/is_convertible.hpp> // for boost::is_convertible
#include <boost/type_traits/is_same.hpp>// for boost::is_same
#include <boost/type_traits/remove_cv.hpp>// for boost::remove_cv
// Boost Template meta programming:
#include <boost/mpl/if.hpp> // for boost::mpl::if_c.
#include <boost/mpl/and.hpp> // for boost::mpl::if_c.
#include <boost/mpl/or.hpp> // for boost::mpl::if_c.
#include <boost/mpl/not.hpp> // for boost::mpl::if_c.
#include <type_traits>
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
#include <boost/static_assert.hpp>
@@ -68,31 +58,31 @@ namespace boost
template <class T>
struct promote_arg
{ // If T is integral type, then promote to double.
typedef typename mpl::if_<is_integral<T>, double, T>::type type;
using type = typename std::conditional<std::is_integral<T>::value, double, T>::type;
};
// These full specialisations reduce mpl::if_ usage and speed up
// These full specialisations reduce std::conditional usage and speed up
// compilation:
template <> struct promote_arg<float> { typedef float type; };
template <> struct promote_arg<double>{ typedef double type; };
template <> struct promote_arg<long double> { typedef long double type; };
template <> struct promote_arg<int> { typedef double type; };
template <> struct promote_arg<float> { using type = float; };
template <> struct promote_arg<double>{ using type = double; };
template <> struct promote_arg<long double> { using type = long double; };
template <> struct promote_arg<int> { using type = double; };
template <class T1, class T2>
struct promote_args_2
{ // Promote, if necessary, & pick the wider of the two floating-point types.
// for both parameter types, if integral promote to double.
typedef typename promote_arg<T1>::type T1P; // T1 perhaps promoted.
typedef typename promote_arg<T2>::type T2P; // T2 perhaps promoted.
using T1P = typename promote_arg<T1>::type; // T1 perhaps promoted.
using T2P = typename promote_arg<T2>::type; // T2 perhaps promoted.
typedef typename mpl::if_c<
is_floating_point<T1P>::value && is_floating_point<T2P>::value, // both T1P and T2P are floating-point?
using type = typename std::conditional<
std::is_floating_point<T1P>::value && std::is_floating_point<T2P>::value, // both T1P and T2P are floating-point?
#ifdef BOOST_MATH_USE_FLOAT128
typename mpl::if_c<is_same<__float128, T1P>::value || is_same<__float128, T2P>::value, // either long double?
typename std::conditional<std::is_same<__float128, T1P>::value || std::is_same<__float128, T2P>::value, // either long double?
__float128,
#endif
typename mpl::if_c<is_same<long double, T1P>::value || is_same<long double, T2P>::value, // either long double?
typename std::conditional<std::is_same<long double, T1P>::value || std::is_same<long double, T2P>::value, // either long double?
long double, // then result type is long double.
typename mpl::if_c<is_same<double, T1P>::value || is_same<double, T2P>::value, // either double?
typename std::conditional<std::is_same<double, T1P>::value || std::is_same<double, T2P>::value, // either double?
double, // result type is double.
float // else result type is float.
>::type
@@ -101,51 +91,51 @@ namespace boost
#endif
>::type,
// else one or the other is a user-defined type:
typename mpl::if_c<!is_floating_point<T2P>::value && ::boost::is_convertible<T1P, T2P>::value, T2P, T1P>::type>::type type;
typename std::conditional<!std::is_floating_point<T2P>::value && std::is_convertible<T1P, T2P>::value, T2P, T1P>::type>::type;
}; // promote_arg2
// These full specialisations reduce mpl::if_ usage and speed up
// These full specialisations reduce std::conditional usage and speed up
// compilation:
template <> struct promote_args_2<float, float> { typedef float type; };
template <> struct promote_args_2<double, double>{ typedef double type; };
template <> struct promote_args_2<long double, long double> { typedef long double type; };
template <> struct promote_args_2<int, int> { typedef double type; };
template <> struct promote_args_2<int, float> { typedef double type; };
template <> struct promote_args_2<float, int> { typedef double type; };
template <> struct promote_args_2<int, double> { typedef double type; };
template <> struct promote_args_2<double, int> { typedef double type; };
template <> struct promote_args_2<int, long double> { typedef long double type; };
template <> struct promote_args_2<long double, int> { typedef long double type; };
template <> struct promote_args_2<float, double> { typedef double type; };
template <> struct promote_args_2<double, float> { typedef double type; };
template <> struct promote_args_2<float, long double> { typedef long double type; };
template <> struct promote_args_2<long double, float> { typedef long double type; };
template <> struct promote_args_2<double, long double> { typedef long double type; };
template <> struct promote_args_2<long double, double> { typedef long double type; };
template <> struct promote_args_2<float, float> { using type = float; };
template <> struct promote_args_2<double, double>{ using type = double; };
template <> struct promote_args_2<long double, long double> { using type = long double; };
template <> struct promote_args_2<int, int> { using type = double; };
template <> struct promote_args_2<int, float> { using type = double; };
template <> struct promote_args_2<float, int> { using type = double; };
template <> struct promote_args_2<int, double> { using type = double; };
template <> struct promote_args_2<double, int> { using type = double; };
template <> struct promote_args_2<int, long double> { using type = long double; };
template <> struct promote_args_2<long double, int> { using type = long double; };
template <> struct promote_args_2<float, double> { using type = double; };
template <> struct promote_args_2<double, float> { using type = double; };
template <> struct promote_args_2<float, long double> { using type = long double; };
template <> struct promote_args_2<long double, float> { using type = long double; };
template <> struct promote_args_2<double, long double> { using type = long double; };
template <> struct promote_args_2<long double, double> { using type = long double; };
template <class T1, class T2=float, class T3=float, class T4=float, class T5=float, class T6=float>
struct promote_args
{
typedef typename promote_args_2<
typename remove_cv<T1>::type,
using type = typename promote_args_2<
typename std::remove_cv<T1>::type,
typename promote_args_2<
typename remove_cv<T2>::type,
typename std::remove_cv<T2>::type,
typename promote_args_2<
typename remove_cv<T3>::type,
typename std::remove_cv<T3>::type,
typename promote_args_2<
typename remove_cv<T4>::type,
typename std::remove_cv<T4>::type,
typename promote_args_2<
typename remove_cv<T5>::type, typename remove_cv<T6>::type
typename std::remove_cv<T5>::type, typename std::remove_cv<T6>::type
>::type
>::type
>::type
>::type
>::type type;
>::type;
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
//
// Guard against use of long double if it's not supported:
//
BOOST_STATIC_ASSERT_MSG((0 == ::boost::is_same<type, long double>::value), "Sorry, but this platform does not have sufficient long double support for the special functions to be reliably implemented.");
BOOST_STATIC_ASSERT_MSG((0 == std::is_same<type, long double>::value), "Sorry, but this platform does not have sufficient long double support for the special functions to be reliably implemented.");
#endif
};
@@ -157,21 +147,21 @@ namespace boost
template <class T1, class T2=float, class T3=float, class T4=float, class T5=float, class T6=float>
struct promote_args_permissive
{
typedef typename promote_args_2<
typename remove_cv<T1>::type,
using type = typename promote_args_2<
typename std::remove_cv<T1>::type,
typename promote_args_2<
typename remove_cv<T2>::type,
typename std::remove_cv<T2>::type,
typename promote_args_2<
typename remove_cv<T3>::type,
typename std::remove_cv<T3>::type,
typename promote_args_2<
typename remove_cv<T4>::type,
typename std::remove_cv<T4>::type,
typename promote_args_2<
typename remove_cv<T5>::type, typename remove_cv<T6>::type
typename std::remove_cv<T5>::type, typename std::remove_cv<T6>::type
>::type
>::type
>::type
>::type
>::type type;
>::type;
};
} // namespace tools

View File

@@ -12,7 +12,6 @@
#include <boost/array.hpp>
#include <boost/math/tools/config.hpp>
#include <boost/mpl/int.hpp>
#if BOOST_MATH_POLY_METHOD == 1
# define BOOST_HEADER() <BOOST_JOIN(boost/math/tools/detail/polynomial_horner1_, BOOST_MATH_MAX_POLY_ORDER).hpp>