diff options
Diffstat (limited to 'boost/math/special_functions/detail/unchecked_bernoulli.hpp')
-rw-r--r-- | boost/math/special_functions/detail/unchecked_bernoulli.hpp | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/boost/math/special_functions/detail/unchecked_bernoulli.hpp b/boost/math/special_functions/detail/unchecked_bernoulli.hpp index 03c376678d..5a16d9df17 100644 --- a/boost/math/special_functions/detail/unchecked_bernoulli.hpp +++ b/boost/math/special_functions/detail/unchecked_bernoulli.hpp @@ -19,6 +19,13 @@ #include <boost/mpl/int.hpp> #include <boost/type_traits/is_convertible.hpp> +#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES +#include <array> +#else +#include <boost/array.hpp> +#endif + + namespace boost { namespace math { namespace detail { @@ -83,9 +90,13 @@ struct max_bernoulli_b2n : public detail::max_bernoulli_index<detail::bernoulli_ namespace detail{ template <class T> -inline T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<0>& ) +inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<0>& ) { +#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES + constexpr std::array<boost::int64_t, 1 + max_bernoulli_b2n<T>::value> numerators = +#else static const boost::array<boost::int64_t, 1 + max_bernoulli_b2n<T>::value> numerators = +#endif {{ boost::int64_t( +1LL), boost::int64_t( +1LL), @@ -107,7 +118,11 @@ inline T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<0>& ) boost::int64_t(+2577687858367LL) }}; +#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES + constexpr std::array<boost::int64_t, 1 + max_bernoulli_b2n<T>::value> denominators = +#else static const boost::array<boost::int64_t, 1 + max_bernoulli_b2n<T>::value> denominators = +#endif {{ boost::int64_t( 1LL), boost::int64_t( 6LL), @@ -132,9 +147,13 @@ inline T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<0>& ) } template <class T> -inline T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<1>& ) +inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<1>& ) { +#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES + constexpr std::array<float, 1 + max_bernoulli_b2n<T>::value> bernoulli_data = +#else static const boost::array<float, 1 + max_bernoulli_b2n<T>::value> bernoulli_data = +#endif {{ +1.00000000000000000000000000000000000000000F, +0.166666666666666666666666666666666666666667F, @@ -176,9 +195,13 @@ inline T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<1>& ) template <class T> -inline T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<2>& ) +inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<2>& ) { +#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES + constexpr std::array<double, 1 + max_bernoulli_b2n<T>::value> bernoulli_data = +#else static const boost::array<double, 1 + max_bernoulli_b2n<T>::value> bernoulli_data = +#endif {{ +1.00000000000000000000000000000000000000000, +0.166666666666666666666666666666666666666667, @@ -316,9 +339,13 @@ inline T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<2>& ) } template <class T> -inline T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<3>& ) +inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<3>& ) { +#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES + constexpr std::array<long double, 1 + max_bernoulli_b2n<T>::value> bernoulli_data = +#else static const boost::array<long double, 1 + max_bernoulli_b2n<T>::value> bernoulli_data = +#endif {{ +1.00000000000000000000000000000000000000000L, +0.166666666666666666666666666666666666666667L, @@ -688,7 +715,7 @@ inline T unchecked_bernoulli_imp(std::size_t n, const mpl::int_<4>& ) } // namespace detail template<class T> -inline T unchecked_bernoulli_b2n(const std::size_t n) +inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION T unchecked_bernoulli_b2n(const std::size_t n) { typedef mpl::int_<detail::bernoulli_imp_variant<T>::value> tag_type; |