update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -7,14 +7,13 @@
#ifndef BOOST_MATH_CALCULATE_CONSTANTS_CONSTANTS_INCLUDED
#define BOOST_MATH_CALCULATE_CONSTANTS_CONSTANTS_INCLUDED
#include <boost/math/special_functions/trunc.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(mpl::int_<N>))
inline T constant_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
@@ -69,21 +68,21 @@ inline T constant_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int
template <class T>
template<int N>
inline T constant_two_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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(mpl::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(mpl::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> > >()));
@@ -91,14 +90,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(mpl::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(mpl::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> > >());
@@ -106,7 +105,7 @@ inline T constant_root_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl
template <class T>
template<int N>
inline T constant_root_half_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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);
@@ -114,7 +113,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(mpl::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> > >());
@@ -122,7 +121,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(mpl::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> > >());
@@ -130,7 +129,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(mpl::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)));
@@ -138,7 +137,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(mpl::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
@@ -151,14 +150,14 @@ inline T constant_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_
template <class T>
template<int N>
inline T constant_half<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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(mpl::int_<M>))
inline T constant_euler<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, M>)))
{
BOOST_MATH_STD_USING
//
@@ -193,7 +192,7 @@ inline T constant_euler<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::
template <class T>
template<int N>
inline T constant_euler_sqr<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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> > >()
@@ -202,7 +201,7 @@ inline T constant_euler_sqr<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(m
template <class T>
template<int N>
inline T constant_one_div_euler<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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)
@@ -212,7 +211,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(mpl::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));
@@ -221,7 +220,7 @@ inline T constant_root_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mp
template <class T>
template<int N>
inline T constant_root_three<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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));
@@ -229,7 +228,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(mpl::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;
@@ -237,7 +236,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(mpl::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
@@ -250,7 +249,7 @@ inline T constant_ln_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl:
template <class T>
template<int N>
inline T constant_ln_ten<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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));
@@ -258,7 +257,7 @@ inline T constant_ln_ten<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl:
template <class T>
template<int N>
inline T constant_ln_ln_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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)));
@@ -266,7 +265,7 @@ inline T constant_ln_ln_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(m
template <class T>
template<int N>
inline T constant_third<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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);
@@ -274,7 +273,7 @@ inline T constant_third<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::
template <class T>
template<int N>
inline T constant_twothirds<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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);
@@ -282,7 +281,7 @@ inline T constant_twothirds<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(m
template <class T>
template<int N>
inline T constant_two_thirds<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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);
@@ -290,7 +289,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(mpl::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);
@@ -298,7 +297,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(mpl::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);
@@ -307,29 +306,21 @@ inline T constant_sixth<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::
// Pi and related constants.
template <class T>
template<int N>
inline T constant_pi_minus_three<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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(mpl::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_pow23_four_minus_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))
//{
// BOOST_MATH_STD_USING
// return pow(four_minus_pi<T, policies::policy<policies::digits2<N> > >(), static_cast<T>(1.5));
//}
template <class T>
template<int N>
inline T constant_exp_minus_half<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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));
@@ -337,7 +328,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(mpl::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.));
@@ -345,28 +336,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(mpl::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(mpl::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(mpl::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(mpl::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> > >());
@@ -374,7 +365,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(mpl::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);
@@ -382,16 +373,15 @@ 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(mpl::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);
}
template <class T>
template<int N>
inline T constant_third_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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);
@@ -399,7 +389,7 @@ inline T constant_third_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mp
template <class T>
template<int N>
inline T constant_sixth_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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);
@@ -407,7 +397,7 @@ inline T constant_sixth_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mp
template <class T>
template<int N>
inline T constant_two_thirds_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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);
@@ -415,7 +405,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(mpl::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);
@@ -423,7 +413,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(mpl::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> > >()); //
@@ -431,7 +421,7 @@ inline T constant_pi_pow_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mp
template <class T>
template<int N>
inline T constant_pi_sqr<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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> > >()
@@ -440,7 +430,7 @@ inline T constant_pi_sqr<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl:
template <class T>
template<int N>
inline T constant_pi_sqr_div_six<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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> > >()
@@ -448,10 +438,9 @@ inline T constant_pi_sqr_div_six<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_S
/ static_cast<T>(6); //
}
template <class T>
template<int N>
inline T constant_pi_cubed<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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> > >()
@@ -462,7 +451,7 @@ inline T constant_pi_cubed<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mp
template <class T>
template<int N>
inline T constant_cbrt_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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));
@@ -470,7 +459,7 @@ inline T constant_cbrt_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl
template <class T>
template<int N>
inline T constant_one_div_cbrt_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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)
@@ -481,7 +470,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(mpl::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> > >()); //
@@ -489,7 +478,7 @@ inline T constant_e_pow_pi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mp
template <class T>
template<int N>
inline T constant_root_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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> > >());
@@ -497,7 +486,7 @@ inline T constant_root_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl:
template <class T>
template<int N>
inline T constant_log10_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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> > >());
@@ -505,7 +494,7 @@ inline T constant_log10_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl
template <class T>
template<int N>
inline T constant_one_div_log10_e<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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) /
@@ -516,7 +505,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(mpl::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> > >()
@@ -526,7 +515,7 @@ inline T constant_degree<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl:
template <class T>
template<int N>
inline T constant_radian<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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)
@@ -536,7 +525,7 @@ inline T constant_radian<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl:
template <class T>
template<int N>
inline T constant_sin_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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)) ; //
@@ -544,7 +533,7 @@ inline T constant_sin_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl
template <class T>
template<int N>
inline T constant_cos_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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)) ; //
@@ -552,7 +541,7 @@ inline T constant_cos_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl
template <class T>
template<int N>
inline T constant_sinh_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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)) ; //
@@ -560,7 +549,7 @@ inline T constant_sinh_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mp
template <class T>
template<int N>
inline T constant_cosh_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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)) ; //
@@ -568,7 +557,7 @@ inline T constant_cosh_one<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mp
template <class T>
template<int N>
inline T constant_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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) ; //
@@ -576,15 +565,15 @@ inline T constant_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::in
template <class T>
template<int N>
inline T constant_ln_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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(phi<T, policies::policy<policies::digits2<N> > >()); // ???
return log((static_cast<T>(1) + sqrt(static_cast<T>(5)) )/static_cast<T>(2) );
}
template <class T>
template<int N>
inline T constant_one_div_ln_phi<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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) /
@@ -595,7 +584,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(mpl::int_<N>))
inline T constant_zeta_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
@@ -606,7 +595,7 @@ inline T constant_zeta_two<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mp
template <class T>
template<int N>
inline T constant_zeta_three<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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
@@ -666,7 +655,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(mpl::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");
@@ -766,7 +755,7 @@ T khinchin(int digits)
template <class T>
template<int N>
inline T constant_khinchin<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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);
@@ -774,9 +763,8 @@ inline T constant_khinchin<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mp
template <class T>
template<int N>
inline T constant_extreme_value_skewness<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))
{ // from e_float constants.cpp
// Mathematica: N[12 Sqrt[6] Zeta[3]/Pi^3, 1101]
inline T constant_extreme_value_skewness<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{ // N[12 Sqrt[6] Zeta[3]/Pi^3, 1101]
BOOST_MATH_STD_USING
T ev(12 * sqrt(static_cast<T>(6)) * zeta_three<T, policies::policy<policies::digits2<N> > >()
/ pi_cubed<T, policies::policy<policies::digits2<N> > >() );
@@ -819,7 +807,6 @@ T zeta_series_derivative_2(unsigned digits)
// Derivative of the series part, evaluated at 2:
BOOST_MATH_STD_USING
int n = digits * 301 * 13 / 10000;
boost::math::itrunc((std::numeric_limits<T>::digits10 + 1) * 1.3);
T d = pow(3 + sqrt(T(8)), n);
d = (d + 1 / d) / 2;
T b = -1;
@@ -882,7 +869,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(mpl::int_<N>))
inline T constant_glaisher<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
BOOST_MATH_STD_USING
@@ -896,61 +883,60 @@ inline T constant_glaisher<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mp
v /= -12;
return exp(v);
/*
/*
// from http://mpmath.googlecode.com/svn/data/glaisher.txt
// 20,000 digits of the Glaisher-Kinkelin constant A = exp(1/2 - zeta'(-1))
// Computed using A = exp((6 (-zeta'(2))/pi^2 + log 2 pi + gamma)/12)
// with Euler-Maclaurin summation for zeta'(2).
T g(
"1.282427129100622636875342568869791727767688927325001192063740021740406308858826"
"46112973649195820237439420646120399000748933157791362775280404159072573861727522"
"14334327143439787335067915257366856907876561146686449997784962754518174312394652"
"76128213808180219264516851546143919901083573730703504903888123418813674978133050"
"93770833682222494115874837348064399978830070125567001286994157705432053927585405"
"81731588155481762970384743250467775147374600031616023046613296342991558095879293"
"36343887288701988953460725233184702489001091776941712153569193674967261270398013"
"52652668868978218897401729375840750167472114895288815996668743164513890306962645"
"59870469543740253099606800842447417554061490189444139386196089129682173528798629"
"88434220366989900606980888785849587494085307347117090132667567503310523405221054"
"14176776156308191919997185237047761312315374135304725819814797451761027540834943"
"14384965234139453373065832325673954957601692256427736926358821692159870775858274"
"69575162841550648585890834128227556209547002918593263079373376942077522290940187");
// with Euler-Maclaurin summation for zeta'(2).
T g(
"1.282427129100622636875342568869791727767688927325001192063740021740406308858826"
"46112973649195820237439420646120399000748933157791362775280404159072573861727522"
"14334327143439787335067915257366856907876561146686449997784962754518174312394652"
"76128213808180219264516851546143919901083573730703504903888123418813674978133050"
"93770833682222494115874837348064399978830070125567001286994157705432053927585405"
"81731588155481762970384743250467775147374600031616023046613296342991558095879293"
"36343887288701988953460725233184702489001091776941712153569193674967261270398013"
"52652668868978218897401729375840750167472114895288815996668743164513890306962645"
"59870469543740253099606800842447417554061490189444139386196089129682173528798629"
"88434220366989900606980888785849587494085307347117090132667567503310523405221054"
"14176776156308191919997185237047761312315374135304725819814797451761027540834943"
"14384965234139453373065832325673954957601692256427736926358821692159870775858274"
"69575162841550648585890834128227556209547002918593263079373376942077522290940187");
return g;
*/
return g;
*/
}
template <class T>
template<int N>
inline T constant_rayleigh_skewness<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))
{ // From e_float
// 1100 digits of the Rayleigh distribution skewness
// Mathematica: N[2 Sqrt[Pi] (Pi - 3)/((4 - Pi)^(3/2)), 1100]
inline T constant_rayleigh_skewness<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{ // 1100 digits of the Rayleigh distribution skewness
// N[2 Sqrt[Pi] (Pi - 3)/((4 - Pi)^(3/2)), 1100]
BOOST_MATH_STD_USING
T rs(2 * root_pi<T, policies::policy<policies::digits2<N> > >()
* pi_minus_three<T, policies::policy<policies::digits2<N> > >()
/ pow(four_minus_pi<T, policies::policy<policies::digits2<N> > >(), static_cast<T>(3./2))
);
// 6.31110657818937138191899351544227779844042203134719497658094585692926819617473725459905027032537306794400047264,
// 6.31110657818937138191899351544227779844042203134719497658094585692926819617473725459905027032537306794400047264,
//"0.6311106578189371381918993515442277798440422031347194976580945856929268196174737254599050270325373067"
//"9440004726436754739597525250317640394102954301685809920213808351450851396781817932734836994829371322"
//"5797376021347531983451654130317032832308462278373358624120822253764532674177325950686466133508511968"
//"2389168716630349407238090652663422922072397393006683401992961569208109477307776249225072042971818671"
//"4058887072693437217879039875871765635655476241624825389439481561152126886932506682176611183750503553"
//"1218982627032068396407180216351425758181396562859085306247387212297187006230007438534686340210168288"
//"8956816965453815849613622117088096547521391672977226658826566757207615552041767516828171274858145957"
//"6137539156656005855905288420585194082284972984285863898582313048515484073396332610565441264220790791"
//"0194897267890422924599776483890102027823328602965235306539844007677157873140562950510028206251529523"
//"7428049693650605954398446899724157486062545281504433364675815915402937209673727753199567661561209251"
//"4695589950526053470201635372590001578503476490223746511106018091907936826431407434894024396366284848"); ;
return rs;
//"0.6311106578189371381918993515442277798440422031347194976580945856929268196174737254599050270325373067"
//"9440004726436754739597525250317640394102954301685809920213808351450851396781817932734836994829371322"
//"5797376021347531983451654130317032832308462278373358624120822253764532674177325950686466133508511968"
//"2389168716630349407238090652663422922072397393006683401992961569208109477307776249225072042971818671"
//"4058887072693437217879039875871765635655476241624825389439481561152126886932506682176611183750503553"
//"1218982627032068396407180216351425758181396562859085306247387212297187006230007438534686340210168288"
//"8956816965453815849613622117088096547521391672977226658826566757207615552041767516828171274858145957"
//"6137539156656005855905288420585194082284972984285863898582313048515484073396332610565441264220790791"
//"0194897267890422924599776483890102027823328602965235306539844007677157873140562950510028206251529523"
//"7428049693650605954398446899724157486062545281504433364675815915402937209673727753199567661561209251"
//"4695589950526053470201635372590001578503476490223746511106018091907936826431407434894024396366284848"); ;
return rs;
}
template <class T>
template<int N>
inline T constant_rayleigh_kurtosis_excess<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::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
@@ -965,7 +951,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(mpl::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
@@ -978,6 +964,146 @@ inline T constant_rayleigh_kurtosis<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYP
);
}
}}}} // namespaces
template <class T>
template<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((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((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((std::integral_constant<int, N>)))
{
return 2 * boost::math::constants::one_div_root_pi<T>();
}
#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((std::integral_constant<int, N>)))
{
// We know the constant to 1018 decimal digits.
// See: http://www.plouffe.fr/simon/constants/feigenbaum.txt
// Also: https://oeis.org/A006890
// N is in binary digits; so we multiply by log_2(10)
static_assert(N < 3.321*1018, "\nThe first Feigenbaum constant cannot be computed at runtime; it is too expensive. It is known to 1018 decimal digits; you must request less than that.");
T alpha{"4.6692016091029906718532038204662016172581855774757686327456513430041343302113147371386897440239480138171659848551898151344086271420279325223124429888908908599449354632367134115324817142199474556443658237932020095610583305754586176522220703854106467494942849814533917262005687556659523398756038256372256480040951071283890611844702775854285419801113440175002428585382498335715522052236087250291678860362674527213399057131606875345083433934446103706309452019115876972432273589838903794946257251289097948986768334611626889116563123474460575179539122045562472807095202198199094558581946136877445617396074115614074243754435499204869180982648652368438702799649017397793425134723808737136211601860128186102056381818354097598477964173900328936171432159878240789776614391395764037760537119096932066998361984288981837003229412030210655743295550388845849737034727532121925706958414074661841981961006129640161487712944415901405467941800198133253378592493365883070459999938375411726563553016862529032210862320550634510679399023341675"};
return alpha;
}
template <class T>
template<int N>
inline T constant_plastic<T>::compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))
{
using std::sqrt;
return (cbrt(9-sqrt(T(69))) + cbrt(9+sqrt(T(69))))/cbrt(T(18));
}
template <class T>
template<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));
T g = 1;
const T scale = sqrt(std::numeric_limits<T>::epsilon())/512;
while (a-g > scale*g)
{
T anp1 = (a + g)/2;
g = sqrt(a*g);
a = anp1;
}
return 2/(a + g);
}
template <class T>
template<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;
using std::abs;
using std::sin;
T x{".739085133215160641655312087673873404013411758900757464965680635773284654883547594599376106931766531849801246"};
T residual = cos(x) - x;
do {
x += residual/(sin(x)+1);
residual = cos(x) - x;
} while(abs(residual) > std::numeric_limits<T>::epsilon());
return x;
}
template <class T>
template<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.
// That said, the condition number is unity, so it should be fine.
T x0 = 1;
T x1 = 1;
T sum = 2;
T diff = 1;
while (diff > std::numeric_limits<T>::epsilon()) {
T tmp = x1 + x0;
diff = 1/tmp;
sum += diff;
x0 = x1;
x1 = tmp;
}
return sum;
}
template <class T>
template<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
// 2.6389delta. Take delta as half an epsilon and give some leeway so we don't get caught in an infinite loop,
// gives a termination condition as 2eps.
using std::abs;
using std::exp;
using std::sqrt;
T x{"0.66274341934918158097474209710925290705623354911502241752039253499097185308651127724965480259895818168"};
T tmp = sqrt(1+x*x);
T etmp = exp(tmp);
T residual = x*exp(tmp) - 1 - tmp;
T df = etmp -x/tmp + etmp*x*x/tmp;
do {
x -= residual/df;
tmp = sqrt(1+x*x);
etmp = exp(tmp);
residual = x*exp(tmp) - 1 - tmp;
df = etmp -x/tmp + etmp*x*x/tmp;
} while(abs(residual) > 2*std::numeric_limits<T>::epsilon());
return x;
}
#endif
}
}
}
} // namespaces
#endif // BOOST_MATH_CALCULATE_CONSTANTS_CONSTANTS_INCLUDED

View File

@@ -8,31 +8,26 @@
#define BOOST_MATH_CONSTANTS_CONSTANTS_INCLUDED
#include <boost/math/tools/config.hpp>
#include <boost/math/tools/cxx03_warn.hpp>
#include <boost/math/policies/policy.hpp>
#include <boost/math/tools/precision.hpp>
#include <boost/math/tools/convert_from_string.hpp>
#ifdef BOOST_MSVC
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4127 4701)
#endif
#ifndef BOOST_MATH_NO_LEXICAL_CAST
#include <boost/lexical_cast.hpp>
#endif
#ifdef BOOST_MSVC
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/int.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/declval.hpp>
#include <utility>
#include <type_traits>
#if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128)
//
// This is the only way we can avoid
// warning: non-standard suffix on floating constant [-Wpedantic]
// when building with -Wall -pedantic. Neither __extension__
// nor #pragma dianostic ignored work :(
// nor #pragma diagnostic ignored work :(
//
#pragma GCC system_header
#endif
@@ -76,49 +71,27 @@ namespace boost{ namespace math
//
// Max number of binary digits in the string representations of our constants:
//
BOOST_STATIC_CONSTANT(int, max_string_digits = (101 * 1000L) / 301L);
static constexpr int max_string_digits = (101 * 1000L) / 301L;
template <class Real, class Policy>
template <typename Real, typename Policy>
struct construction_traits
{
private:
typedef typename policies::precision<Real, Policy>::type t1;
typedef typename policies::precision<float, Policy>::type t2;
typedef typename policies::precision<double, Policy>::type t3;
typedef typename policies::precision<long double, Policy>::type t4;
#ifdef BOOST_MATH_USE_FLOAT128
typedef mpl::int_<113> t5;
#endif
using real_precision = typename policies::precision<Real, Policy>::type;
using float_precision = typename policies::precision<float, Policy>::type;
using double_precision = typename policies::precision<double, Policy>::type;
using long_double_precision = typename policies::precision<long double, Policy>::type;
public:
typedef typename mpl::if_<
mpl::and_<boost::is_convertible<float, Real>, mpl::bool_< t1::value <= t2::value>, mpl::bool_<0 != t1::value> >,
mpl::int_<construct_from_float>,
typename mpl::if_<
mpl::and_<boost::is_convertible<double, Real>, mpl::bool_< t1::value <= t3::value>, mpl::bool_<0 != t1::value> >,
mpl::int_<construct_from_double>,
typename mpl::if_<
mpl::and_<boost::is_convertible<long double, Real>, mpl::bool_< t1::value <= t4::value>, mpl::bool_<0 != t1::value> >,
mpl::int_<construct_from_long_double>,
using type = std::integral_constant<int,
(0 == real_precision::value) ? 0 :
std::is_convertible<float, Real>::value && (real_precision::value <= float_precision::value)? construct_from_float :
std::is_convertible<double, Real>::value && (real_precision::value <= double_precision::value)? construct_from_double :
std::is_convertible<long double, Real>::value && (real_precision::value <= long_double_precision::value)? construct_from_long_double :
#ifdef BOOST_MATH_USE_FLOAT128
typename mpl::if_<
mpl::and_<boost::is_convertible<BOOST_MATH_FLOAT128_TYPE, Real>, mpl::bool_< t1::value <= t5::value>, mpl::bool_<0 != t1::value> >,
mpl::int_<construct_from_float128>,
typename mpl::if_<
mpl::and_<mpl::bool_< t1::value <= max_string_digits>, mpl::bool_<0 != t1::value> >,
mpl::int_<construct_from_string>,
mpl::int_<t1::value>
>::type
>::type
#else
typename mpl::if_<
mpl::and_<mpl::bool_< t1::value <= max_string_digits>, mpl::bool_<0 != t1::value> >,
mpl::int_<construct_from_string>,
mpl::int_<t1::value>
>::type
std::is_convertible<BOOST_MATH_FLOAT128_TYPE, Real>::value && (real_precision::value <= 113) ? construct_from_float128 :
#endif
>::type
>::type
>::type type;
(real_precision::value <= max_string_digits) ? construct_from_string : real_precision::value
>;
};
#ifdef BOOST_HAS_THREADS
@@ -134,13 +107,13 @@ namespace boost{ namespace math
template <class Real, class Policy = boost::math::policies::policy<> >
struct constant_return
{
typedef typename construction_traits<Real, Policy>::type construct_type;
typedef typename mpl::if_c<
using construct_type = typename construction_traits<Real, Policy>::type;
using type = typename std::conditional<
(construct_type::value == construct_from_string) || (construct_type::value > construct_max),
const Real&, Real>::type type;
const Real&, Real>::type;
};
template <class T, const T& (*F)()>
template <typename T, const T& (*F)()>
struct constant_initializer
{
static void force_instantiate()
@@ -159,10 +132,10 @@ namespace boost{ namespace math
static const initializer init;
};
template <class T, const T& (*F)()>
template <typename T, const T& (*F)()>
typename constant_initializer<T, F>::initializer const constant_initializer<T, F>::init;
template <class T, int N, const T& (*F)(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T))>
template <typename T, int N, const T& (*F)(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T))>
struct constant_initializer2
{
static void force_instantiate()
@@ -181,14 +154,14 @@ namespace boost{ namespace math
static const initializer init;
};
template <class T, int N, const T& (*F)(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T))>
template <typename T, int N, const T& (*F)(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T))>
typename constant_initializer2<T, N, F>::initializer const constant_initializer2<T, N, F>::init;
}
#ifdef BOOST_MATH_USE_FLOAT128
# define BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) \
static inline BOOST_CONSTEXPR T get(const mpl::int_<construct_from_float128>&) BOOST_NOEXCEPT\
static inline constexpr T get(const std::integral_constant<int, construct_from_float128>&) noexcept\
{ return BOOST_JOIN(x, Q); }
#else
# define BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x)
@@ -202,7 +175,7 @@ namespace boost{ namespace math
#define BOOST_DEFINE_MATH_CONSTANT(name, x, y)\
namespace detail{\
template <class T> struct BOOST_JOIN(constant_, name){\
template <typename T> struct BOOST_JOIN(constant_, name){\
private:\
/* The default implementations come next: */ \
static inline const T& get_from_string()\
@@ -211,8 +184,8 @@ namespace boost{ namespace math
return result;\
}\
/* This one is for very high precision that is none the less known at compile time: */ \
template <int N> static T compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>));\
template <int N> static inline const T& get_from_compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpl::int_<N>))\
template <int N> static T compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)));\
template <int N> static inline const T& get_from_compute(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC((std::integral_constant<int, N>)))\
{\
static const T result = compute<N>();\
return result;\
@@ -231,25 +204,25 @@ namespace boost{ namespace math
}\
/* public getters come next */\
public:\
static inline const T& get(const mpl::int_<construct_from_string>&)\
static inline const T& get(const std::integral_constant<int, construct_from_string>&)\
{\
constant_initializer<T, & BOOST_JOIN(constant_, name)<T>::get_from_string >::force_instantiate();\
return get_from_string();\
}\
static inline BOOST_CONSTEXPR T get(const mpl::int_<construct_from_float>) BOOST_NOEXCEPT\
static inline constexpr T get(const std::integral_constant<int, construct_from_float>) noexcept\
{ return BOOST_JOIN(x, F); }\
static inline BOOST_CONSTEXPR T get(const mpl::int_<construct_from_double>&) BOOST_NOEXCEPT\
static inline constexpr T get(const std::integral_constant<int, construct_from_double>&) noexcept\
{ return x; }\
static inline BOOST_CONSTEXPR T get(const mpl::int_<construct_from_long_double>&) BOOST_NOEXCEPT\
static inline constexpr T get(const std::integral_constant<int, construct_from_long_double>&) noexcept\
{ return BOOST_JOIN(x, L); }\
BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) \
template <int N> static inline const T& get(const mpl::int_<N>&)\
template <int N> static inline const T& get(const std::integral_constant<int, N>&)\
{\
constant_initializer2<T, N, & BOOST_JOIN(constant_, name)<T>::template get_from_compute<N> >::force_instantiate();\
return get_from_compute<N>(); \
}\
/* This one is for true arbitary precision, which may well vary at runtime: */ \
static inline T get(const mpl::int_<0>&)\
/* This one is for true arbitrary precision, which may well vary at runtime: */ \
static inline T get(const std::integral_constant<int, 0>&)\
{\
BOOST_MATH_PRECOMPUTE_IF_NOT_LOCAL(constant_, name)\
return get_from_variable_precision(); }\
@@ -258,16 +231,16 @@ namespace boost{ namespace math
\
\
/* The actual forwarding function: */ \
template <class T, class Policy> inline BOOST_CONSTEXPR typename detail::constant_return<T, Policy>::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(Policy)) BOOST_MATH_NOEXCEPT(T)\
template <typename T, typename Policy> inline constexpr typename detail::constant_return<T, Policy>::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(Policy)) BOOST_MATH_NOEXCEPT(T)\
{ return detail:: BOOST_JOIN(constant_, name)<T>::get(typename construction_traits<T, Policy>::type()); }\
template <class T> inline BOOST_CONSTEXPR typename detail::constant_return<T>::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T)\
template <typename T> inline constexpr typename detail::constant_return<T>::type name(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T)\
{ return name<T, boost::math::policies::policy<> >(); }\
\
\
/* Now the namespace specific versions: */ \
} namespace float_constants{ BOOST_STATIC_CONSTEXPR float name = BOOST_JOIN(x, F); }\
namespace double_constants{ BOOST_STATIC_CONSTEXPR double name = x; } \
namespace long_double_constants{ BOOST_STATIC_CONSTEXPR long double name = BOOST_JOIN(x, L); }\
} namespace float_constants{ static constexpr float name = BOOST_JOIN(x, F); }\
namespace double_constants{ static constexpr double name = x; } \
namespace long_double_constants{ static constexpr long double name = BOOST_JOIN(x, L); }\
namespace constants{
BOOST_DEFINE_MATH_CONSTANT(half, 5.000000000000000000000000000000000000e-01, "5.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-01")
@@ -308,6 +281,7 @@ namespace boost{ namespace math
BOOST_DEFINE_MATH_CONSTANT(pi_cubed, 3.100627668029982017547631506710139520e+01, "3.10062766802998201754763150671013952022252885658851076941445381038063949174657060375667010326028861930301219616e+01")
BOOST_DEFINE_MATH_CONSTANT(cbrt_pi, 1.464591887561523263020142527263790391e+00, "1.46459188756152326302014252726379039173859685562793717435725593713839364979828626614568206782035382089750397002e+00")
BOOST_DEFINE_MATH_CONSTANT(one_div_cbrt_pi, 6.827840632552956814670208331581645981e-01, "6.82784063255295681467020833158164598108367515632448804042681583118899226433403918237673501922595519865685577274e-01")
BOOST_DEFINE_MATH_CONSTANT(log2_e, 1.44269504088896340735992468100189213742664595415298, "1.44269504088896340735992468100189213742664595415298593413544940693110921918118507988552662289350634449699751830965e+00")
BOOST_DEFINE_MATH_CONSTANT(e, 2.718281828459045235360287471352662497e+00, "2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193e+00")
BOOST_DEFINE_MATH_CONSTANT(exp_minus_half, 6.065306597126334236037995349911804534e-01, "6.06530659712633423603799534991180453441918135487186955682892158735056519413748423998647611507989456026423789794e-01")
BOOST_DEFINE_MATH_CONSTANT(exp_minus_one, 3.678794411714423215955237701614608674e-01, "3.67879441171442321595523770161460867445811131031767834507836801697461495744899803357147274345919643746627325277e-01")
@@ -340,7 +314,21 @@ namespace boost{ namespace math
BOOST_DEFINE_MATH_CONSTANT(two_div_pi, 6.366197723675813430755350534900574481e-01, "6.36619772367581343075535053490057448137838582961825794990669376235587190536906140360455211065012343824291370907e-01")
BOOST_DEFINE_MATH_CONSTANT(root_two_div_pi, 7.978845608028653558798921198687637369e-01, "7.97884560802865355879892119868763736951717262329869315331851659341315851798603677002504667814613872860605117725e-01")
BOOST_DEFINE_MATH_CONSTANT(quarter_pi, 0.785398163397448309615660845819875721049292, "0.785398163397448309615660845819875721049292349843776455243736148076954101571552249657008706335529266995537021628320576661773")
BOOST_DEFINE_MATH_CONSTANT(one_div_pi, 0.3183098861837906715377675267450287240689192, "0.31830988618379067153776752674502872406891929148091289749533468811779359526845307018022760553250617191214568545351")
BOOST_DEFINE_MATH_CONSTANT(two_div_root_pi, 1.12837916709551257389615890312154517168810125, "1.12837916709551257389615890312154517168810125865799771368817144342128493688298682897348732040421472688605669581272")
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900)
BOOST_DEFINE_MATH_CONSTANT(first_feigenbaum, 4.66920160910299067185320382046620161725818557747576863274, "4.6692016091029906718532038204662016172581855774757686327456513430041343302113147371386897440239480138171")
BOOST_DEFINE_MATH_CONSTANT(plastic, 1.324717957244746025960908854478097340734404056901733364534, "1.32471795724474602596090885447809734073440405690173336453401505030282785124554759405469934798178728032991")
BOOST_DEFINE_MATH_CONSTANT(gauss, 0.834626841674073186281429732799046808993993013490347002449, "0.83462684167407318628142973279904680899399301349034700244982737010368199270952641186969116035127532412906785")
BOOST_DEFINE_MATH_CONSTANT(dottie, 0.739085133215160641655312087673873404013411758900757464965, "0.739085133215160641655312087673873404013411758900757464965680635773284654883547594599376106931766531849801246")
BOOST_DEFINE_MATH_CONSTANT(reciprocal_fibonacci, 3.35988566624317755317201130291892717968890513, "3.35988566624317755317201130291892717968890513373196848649555381532513031899668338361541621645679008729704")
BOOST_DEFINE_MATH_CONSTANT(laplace_limit, 0.662743419349181580974742097109252907056233549115022417, "0.66274341934918158097474209710925290705623354911502241752039253499097185308651127724965480259895818168")
#endif
template <typename T>
inline constexpr T tau() { return two_pi<T>(); }
} // namespace constants
} // namespace math

View File

@@ -46,7 +46,7 @@ template <class T, class Policy>
void print_info_on_type(std::ostream& os = std::cout BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(T) BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(Policy))
{
using detail::nameof;
#ifdef BOOST_MSVC
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4127)
#endif
@@ -147,7 +147,7 @@ void print_info_on_type(std::ostream& os = std::cout BOOST_MATH_APPEND_EXPLICIT_
break;
}
os << std::endl;
#ifdef BOOST_MSVC
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}