summaryrefslogtreecommitdiff
path: root/boost/math/special_functions/detail
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 06:12:59 (GMT)
committerDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 06:12:59 (GMT)
commitb8cf34c691623e4ec329053cbbf68522a855882d (patch)
tree34da08632a99677f6b79ecb65e5b655a5b69a67f /boost/math/special_functions/detail
parent3fdc3e5ee96dca5b11d1694975a65200787eab86 (diff)
downloadboost-b8cf34c691623e4ec329053cbbf68522a855882d.zip
boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.gz
boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.bz2
Imported Upstream version 1.67.0upstream/1.67.0
Diffstat (limited to 'boost/math/special_functions/detail')
-rw-r--r--boost/math/special_functions/detail/bernoulli_details.hpp9
-rw-r--r--boost/math/special_functions/detail/fp_traits.hpp3
-rw-r--r--boost/math/special_functions/detail/unchecked_bernoulli.hpp37
-rw-r--r--boost/math/special_functions/detail/unchecked_factorial.hpp29
4 files changed, 66 insertions, 12 deletions
diff --git a/boost/math/special_functions/detail/bernoulli_details.hpp b/boost/math/special_functions/detail/bernoulli_details.hpp
index 41a59e5..75fadbf 100644
--- a/boost/math/special_functions/detail/bernoulli_details.hpp
+++ b/boost/math/special_functions/detail/bernoulli_details.hpp
@@ -192,9 +192,18 @@ struct fixed_vector : private std::allocator<T>
}
~fixed_vector()
{
+#ifdef BOOST_NO_CXX11_ALLOCATOR
for(unsigned i = 0; i < m_used; ++i)
this->destroy(&m_data[i]);
this->deallocate(m_data, m_capacity);
+#else
+ typedef std::allocator<T> allocator_type;
+ typedef std::allocator_traits<allocator_type> allocator_traits;
+ allocator_type& alloc = *this;
+ for(unsigned i = 0; i < m_used; ++i)
+ allocator_traits::destroy(alloc, &m_data[i]);
+ allocator_traits::deallocate(alloc, m_data, m_capacity);
+#endif
}
T& operator[](unsigned n) { BOOST_ASSERT(n < m_used); return m_data[n]; }
const T& operator[](unsigned n)const { BOOST_ASSERT(n < m_used); return m_data[n]; }
diff --git a/boost/math/special_functions/detail/fp_traits.hpp b/boost/math/special_functions/detail/fp_traits.hpp
index 09dc516..c957022 100644
--- a/boost/math/special_functions/detail/fp_traits.hpp
+++ b/boost/math/special_functions/detail/fp_traits.hpp
@@ -556,7 +556,8 @@ struct select_native<long double>
&& !defined(__FAST_MATH__)\
&& !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY)\
&& !defined(BOOST_INTEL)\
- && !defined(sun)
+ && !defined(sun)\
+ && !defined(__VXWORKS__)
# define BOOST_MATH_USE_STD_FPCLASSIFY
#endif
diff --git a/boost/math/special_functions/detail/unchecked_bernoulli.hpp b/boost/math/special_functions/detail/unchecked_bernoulli.hpp
index 03c3766..5a16d9d 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;
diff --git a/boost/math/special_functions/detail/unchecked_factorial.hpp b/boost/math/special_functions/detail/unchecked_factorial.hpp
index ca9a752..1736674 100644
--- a/boost/math/special_functions/detail/unchecked_factorial.hpp
+++ b/boost/math/special_functions/detail/unchecked_factorial.hpp
@@ -10,7 +10,6 @@
#pragma once
#endif
-#include <boost/array.hpp>
#ifdef BOOST_MSVC
#pragma warning(push) // Temporary until lexical cast fixed.
#pragma warning(disable: 4127 4701)
@@ -21,9 +20,15 @@
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
-#include <boost/config/no_tr1/cmath.hpp>
+#include <cmath>
#include <boost/math/special_functions/math_fwd.hpp>
+#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
+#include <array>
+#else
+#include <boost/array.hpp>
+#endif
+
namespace boost { namespace math
{
// Forward declarations:
@@ -32,9 +37,13 @@ struct max_factorial;
// Definitions:
template <>
-inline float unchecked_factorial<float>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(float))
+inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION float unchecked_factorial<float>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(float))
{
+#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
+ constexpr std::array<float, 35> factorials = { {
+#else
static const boost::array<float, 35> factorials = {{
+#endif
1.0F,
1.0F,
2.0F,
@@ -83,9 +92,13 @@ struct max_factorial<float>
template <>
-inline long double unchecked_factorial<long double>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(long double))
+inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION long double unchecked_factorial<long double>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(long double))
{
+#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
+ constexpr std::array<long double, 171> factorials = { {
+#else
static const boost::array<long double, 171> factorials = {{
+#endif
1L,
1L,
2L,
@@ -271,9 +284,13 @@ struct max_factorial<long double>
#ifdef BOOST_MATH_USE_FLOAT128
template <>
-inline BOOST_MATH_FLOAT128_TYPE unchecked_factorial<BOOST_MATH_FLOAT128_TYPE>(unsigned i)
+inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION BOOST_MATH_FLOAT128_TYPE unchecked_factorial<BOOST_MATH_FLOAT128_TYPE>(unsigned i)
{
+#ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES
+ constexpr std::array<BOOST_MATH_FLOAT128_TYPE, 171> factorials = { {
+#else
static const boost::array<BOOST_MATH_FLOAT128_TYPE, 171> factorials = { {
+#endif
1,
1,
2,
@@ -459,7 +476,7 @@ struct max_factorial<BOOST_MATH_FLOAT128_TYPE>
#endif
template <>
-inline double unchecked_factorial<double>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(double))
+inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION double unchecked_factorial<double>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(double))
{
return static_cast<double>(boost::math::unchecked_factorial<long double>(i));
}