diff --git a/doc/html/math_toolkit/lambert_w.html b/doc/html/math_toolkit/lambert_w.html index 8671e915e..4604cfc89 100644 --- a/doc/html/math_toolkit/lambert_w.html +++ b/doc/html/math_toolkit/lambert_w.html @@ -1402,7 +1402,7 @@ if (f(w) / f'(w

The arrays are as const and constexpr and static - as possible (for the compiler version), using BOOST_STATIC_CONSTEXPR macro. + as possible (for the compiler version), using static constexpr macro. (See lambert_w_lookup_table_generator.cpp The precision was chosen to ensure that if used as long double arrays, then the values output diff --git a/doc/sf/lambert_w.qbk b/doc/sf/lambert_w.qbk index 36f1ceb69..76734cafb 100644 --- a/doc/sf/lambert_w.qbk +++ b/doc/sf/lambert_w.qbk @@ -503,7 +503,7 @@ and output as C++ arrays 37 decimal digit `long double` literals using `max_digi std::cout.precision(std::numeric_limits::max_digits10); The arrays are as `const` and `constexpr` and `static` as possible (for the compiler version), -using BOOST_STATIC_CONSTEXPR macro. +using static constexpr macro. (See [@../../tools/lambert_w_lookup_table_generator.cpp lambert_w_lookup_table_generator.cpp] The precision was chosen to ensure that if used as `long double` arrays, then the values output to diff --git a/include/boost/math/bindings/mpfr.hpp b/include/boost/math/bindings/mpfr.hpp index 6832600d6..680d1a8f6 100644 --- a/include/boost/math/bindings/mpfr.hpp +++ b/include/boost/math/bindings/mpfr.hpp @@ -11,7 +11,6 @@ #ifndef BOOST_MATH_MPLFR_BINDINGS_HPP #define BOOST_MATH_MPLFR_BINDINGS_HPP -#include #include #include @@ -38,6 +37,7 @@ #include #include #include +#include inline mpfr_class fabs(const mpfr_class& v) { @@ -298,7 +298,7 @@ struct promote_arg<__gmp_expr > }; template<> -inline int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpfr_class)) BOOST_NOEXCEPT +inline int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(mpfr_class)) noexcept { return mpfr_class::get_dprec(); } diff --git a/include/boost/math/bindings/mpreal.hpp b/include/boost/math/bindings/mpreal.hpp index 7ba0dec55..2858b8d77 100644 --- a/include/boost/math/bindings/mpreal.hpp +++ b/include/boost/math/bindings/mpreal.hpp @@ -11,7 +11,6 @@ #ifndef BOOST_MATH_MPREAL_BINDINGS_HPP #define BOOST_MATH_MPREAL_BINDINGS_HPP -#include #include #include @@ -37,6 +36,7 @@ #include #include #include +#include namespace mpfr{ diff --git a/include/boost/math/bindings/rr.hpp b/include/boost/math/bindings/rr.hpp index 419b43428..7c280e616 100644 --- a/include/boost/math/bindings/rr.hpp +++ b/include/boost/math/bindings/rr.hpp @@ -6,9 +6,9 @@ #ifndef BOOST_MATH_NTL_RR_HPP #define BOOST_MATH_NTL_RR_HPP -#include #include #include +#include #include #include #include @@ -41,12 +41,10 @@ public: { m_value = c; } -#ifndef BOOST_NO_INTRINSIC_WCHAR_T RR(wchar_t c) { m_value = c; } -#endif RR(unsigned char c) { m_value = c; @@ -79,16 +77,14 @@ public: { assign_large_int(c); } -#ifdef BOOST_HAS_LONG_LONG - RR(boost::ulong_long_type c) + RR(unsigned long long c) { assign_large_int(c); } - RR(boost::long_long_type c) + RR(long long c) { assign_large_int(c); } -#endif RR(float c) { m_value = c; @@ -106,19 +102,15 @@ public: RR& operator=(char c) { m_value = c; return *this; } RR& operator=(unsigned char c) { m_value = c; return *this; } RR& operator=(signed char c) { m_value = c; return *this; } -#ifndef BOOST_NO_INTRINSIC_WCHAR_T RR& operator=(wchar_t c) { m_value = c; return *this; } -#endif RR& operator=(short c) { m_value = c; return *this; } RR& operator=(unsigned short c) { m_value = c; return *this; } RR& operator=(int c) { assign_large_int(c); return *this; } RR& operator=(unsigned int c) { assign_large_int(c); return *this; } RR& operator=(long c) { assign_large_int(c); return *this; } RR& operator=(unsigned long c) { assign_large_int(c); return *this; } -#ifdef BOOST_HAS_LONG_LONG - RR& operator=(boost::long_long_type c) { assign_large_int(c); return *this; } - RR& operator=(boost::ulong_long_type c) { assign_large_int(c); return *this; } -#endif + RR& operator=(long long c) { assign_large_int(c); return *this; } + RR& operator=(unsigned long long c) { assign_large_int(c); return *this; } RR& operator=(float c) { m_value = c; return *this; } RR& operator=(double c) { m_value = c; return *this; } RR& operator=(long double c) { assign_large_real(c); return *this; } diff --git a/include/boost/math/concepts/real_concept.hpp b/include/boost/math/concepts/real_concept.hpp index 595398ff9..446bfa8d5 100644 --- a/include/boost/math/concepts/real_concept.hpp +++ b/include/boost/math/concepts/real_concept.hpp @@ -23,12 +23,12 @@ #ifndef BOOST_MATH_REAL_CONCEPT_HPP #define BOOST_MATH_REAL_CONCEPT_HPP -#include #include #include #include #include #include +#include #include #include #include @@ -39,6 +39,7 @@ #include #include #include +#include #if defined(__SGI_STL_PORT) || defined(_RWSTD_VER) || defined(__LIBCOMO__) # include @@ -61,9 +62,7 @@ public: // Constructors: real_concept() : m_value(0){} real_concept(char c) : m_value(c){} -#ifndef BOOST_NO_INTRINSIC_WCHAR_T real_concept(wchar_t c) : m_value(c){} -#endif real_concept(unsigned char c) : m_value(c){} real_concept(signed char c) : m_value(c){} real_concept(unsigned short c) : m_value(c){} @@ -72,16 +71,8 @@ public: real_concept(int c) : m_value(c){} real_concept(unsigned long c) : m_value(c){} real_concept(long c) : m_value(c){} -#if defined(__DECCXX) || defined(__SUNPRO_CC) real_concept(unsigned long long c) : m_value(static_cast(c)){} real_concept(long long c) : m_value(static_cast(c)){} -#elif defined(BOOST_HAS_LONG_LONG) - real_concept(boost::ulong_long_type c) : m_value(static_cast(c)){} - real_concept(boost::long_long_type c) : m_value(static_cast(c)){} -#elif defined(BOOST_HAS_MS_INT64) - real_concept(unsigned __int64 c) : m_value(static_cast(c)){} - real_concept(__int64 c) : m_value(static_cast(c)){} -#endif real_concept(float c) : m_value(c){} real_concept(double c) : m_value(c){} real_concept(long double c) : m_value(c){} @@ -93,19 +84,15 @@ public: real_concept& operator=(char c) { m_value = c; return *this; } real_concept& operator=(unsigned char c) { m_value = c; return *this; } real_concept& operator=(signed char c) { m_value = c; return *this; } -#ifndef BOOST_NO_INTRINSIC_WCHAR_T real_concept& operator=(wchar_t c) { m_value = c; return *this; } -#endif real_concept& operator=(short c) { m_value = c; return *this; } real_concept& operator=(unsigned short c) { m_value = c; return *this; } real_concept& operator=(int c) { m_value = c; return *this; } real_concept& operator=(unsigned int c) { m_value = c; return *this; } real_concept& operator=(long c) { m_value = c; return *this; } real_concept& operator=(unsigned long c) { m_value = c; return *this; } -#ifdef BOOST_HAS_LONG_LONG - real_concept& operator=(boost::long_long_type c) { m_value = static_cast(c); return *this; } - real_concept& operator=(boost::ulong_long_type c) { m_value = static_cast(c); return *this; } -#endif + real_concept& operator=(long long c) { m_value = static_cast(c); return *this; } + real_concept& operator=(unsigned long long c) { m_value = static_cast(c); return *this; } real_concept& operator=(float c) { m_value = c; return *this; } real_concept& operator=(double c) { m_value = c; return *this; } real_concept& operator=(long double c) { m_value = c; return *this; } @@ -288,13 +275,11 @@ inline long lround(const concepts::real_concept& v, const Policy& pol) inline long lround(const concepts::real_concept& v) { return boost::math::lround(v.value(), policies::policy<>()); } -#ifdef BOOST_HAS_LONG_LONG template -inline boost::long_long_type llround(const concepts::real_concept& v, const Policy& pol) +inline long long llround(const concepts::real_concept& v, const Policy& pol) { return boost::math::llround(v.value(), pol); } -inline boost::long_long_type llround(const concepts::real_concept& v) +inline long long llround(const concepts::real_concept& v) { return boost::math::llround(v.value(), policies::policy<>()); } -#endif template inline int itrunc(const concepts::real_concept& v, const Policy& pol) @@ -307,13 +292,11 @@ inline long ltrunc(const concepts::real_concept& v, const Policy& pol) inline long ltrunc(const concepts::real_concept& v) { return boost::math::ltrunc(v.value(), policies::policy<>()); } -#ifdef BOOST_HAS_LONG_LONG template -inline boost::long_long_type lltrunc(const concepts::real_concept& v, const Policy& pol) +inline long long lltrunc(const concepts::real_concept& v, const Policy& pol) { return boost::math::lltrunc(v.value(), pol); } -inline boost::long_long_type lltrunc(const concepts::real_concept& v) +inline long long lltrunc(const concepts::real_concept& v) { return boost::math::lltrunc(v.value(), policies::policy<>()); } -#endif // Streaming: template @@ -376,7 +359,7 @@ inline concepts::real_concept epsilon(BOOST_MATH_EXPLICI } template <> -inline constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept)) BOOST_NOEXCEPT +inline constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(concepts::real_concept)) noexcept { // Assume number of significand bits is same as real_concept_base_type, // unless std::numeric_limits::is_specialized to provide digits. diff --git a/include/boost/math/concepts/real_type_concept.hpp b/include/boost/math/concepts/real_type_concept.hpp index 42b4a5ee0..f4eb3f300 100644 --- a/include/boost/math/concepts/real_type_concept.hpp +++ b/include/boost/math/concepts/real_type_concept.hpp @@ -7,7 +7,6 @@ #define BOOST_MATH_REAL_TYPE_CONCEPT_HPP #include -#include #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable: 4100) @@ -83,9 +82,7 @@ struct RealTypeConcept //check_binary_ops(1u); check_binary_ops(1L); //check_binary_ops(1uL); -#ifndef BOOST_HAS_LONG_LONG check_binary_ops(1LL); -#endif RealType r2 = +r; r2 = -r; diff --git a/include/boost/math/constants/constants.hpp b/include/boost/math/constants/constants.hpp index 8b429398e..730256c66 100644 --- a/include/boost/math/constants/constants.hpp +++ b/include/boost/math/constants/constants.hpp @@ -161,7 +161,7 @@ namespace boost{ namespace math #ifdef BOOST_MATH_USE_FLOAT128 # define BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) \ - static inline constexpr T get(const std::integral_constant&) BOOST_NOEXCEPT\ + static inline constexpr T get(const std::integral_constant&) noexcept\ { return BOOST_JOIN(x, Q); } #else # define BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) @@ -209,11 +209,11 @@ namespace boost{ namespace math constant_initializer::get_from_string >::force_instantiate();\ return get_from_string();\ }\ - static inline constexpr T get(const std::integral_constant) BOOST_NOEXCEPT\ + static inline constexpr T get(const std::integral_constant) noexcept\ { return BOOST_JOIN(x, F); }\ - static inline constexpr T get(const std::integral_constant&) BOOST_NOEXCEPT\ + static inline constexpr T get(const std::integral_constant&) noexcept\ { return x; }\ - static inline constexpr T get(const std::integral_constant&) BOOST_NOEXCEPT\ + static inline constexpr T get(const std::integral_constant&) noexcept\ { return BOOST_JOIN(x, L); }\ BOOST_MATH_FLOAT128_CONSTANT_OVERLOAD(x) \ template static inline const T& get(const std::integral_constant&)\ @@ -238,9 +238,9 @@ namespace boost{ namespace math \ \ /* 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") diff --git a/include/boost/math/cstdfloat/cstdfloat_limits.hpp b/include/boost/math/cstdfloat/cstdfloat_limits.hpp index 7009c1786..adef5c216 100644 --- a/include/boost/math/cstdfloat/cstdfloat_limits.hpp +++ b/include/boost/math/cstdfloat/cstdfloat_limits.hpp @@ -45,38 +45,38 @@ class numeric_limits { public: - BOOST_STATIC_CONSTEXPR bool is_specialized = true; - static boost::math::cstdfloat::detail::float_internal128_t (min) () BOOST_NOEXCEPT { return BOOST_CSTDFLOAT_FLOAT128_MIN; } - static boost::math::cstdfloat::detail::float_internal128_t (max) () BOOST_NOEXCEPT { return BOOST_CSTDFLOAT_FLOAT128_MAX; } - static boost::math::cstdfloat::detail::float_internal128_t lowest() BOOST_NOEXCEPT { return -(max)(); } - BOOST_STATIC_CONSTEXPR int digits = 113; - BOOST_STATIC_CONSTEXPR int digits10 = 33; - BOOST_STATIC_CONSTEXPR int max_digits10 = 36; - BOOST_STATIC_CONSTEXPR bool is_signed = true; - BOOST_STATIC_CONSTEXPR bool is_integer = false; - BOOST_STATIC_CONSTEXPR bool is_exact = false; - BOOST_STATIC_CONSTEXPR int radix = 2; + static constexpr bool is_specialized = true; + static boost::math::cstdfloat::detail::float_internal128_t (min) () noexcept { return BOOST_CSTDFLOAT_FLOAT128_MIN; } + static boost::math::cstdfloat::detail::float_internal128_t (max) () noexcept { return BOOST_CSTDFLOAT_FLOAT128_MAX; } + static boost::math::cstdfloat::detail::float_internal128_t lowest() noexcept { return -(max)(); } + static constexpr int digits = 113; + static constexpr int digits10 = 33; + static constexpr int max_digits10 = 36; + static constexpr bool is_signed = true; + static constexpr bool is_integer = false; + static constexpr bool is_exact = false; + static constexpr int radix = 2; static boost::math::cstdfloat::detail::float_internal128_t epsilon () { return BOOST_CSTDFLOAT_FLOAT128_EPS; } static boost::math::cstdfloat::detail::float_internal128_t round_error() { return BOOST_FLOAT128_C(0.5); } - BOOST_STATIC_CONSTEXPR int min_exponent = -16381; - BOOST_STATIC_CONSTEXPR int min_exponent10 = static_cast((min_exponent * 301L) / 1000L); - BOOST_STATIC_CONSTEXPR int max_exponent = +16384; - BOOST_STATIC_CONSTEXPR int max_exponent10 = static_cast((max_exponent * 301L) / 1000L); - BOOST_STATIC_CONSTEXPR bool has_infinity = true; - BOOST_STATIC_CONSTEXPR bool has_quiet_NaN = true; - BOOST_STATIC_CONSTEXPR bool has_signaling_NaN = false; - BOOST_STATIC_CONSTEXPR float_denorm_style has_denorm = denorm_present; - BOOST_STATIC_CONSTEXPR bool has_denorm_loss = false; + static constexpr int min_exponent = -16381; + static constexpr int min_exponent10 = static_cast((min_exponent * 301L) / 1000L); + static constexpr int max_exponent = +16384; + static constexpr int max_exponent10 = static_cast((max_exponent * 301L) / 1000L); + static constexpr bool has_infinity = true; + static constexpr bool has_quiet_NaN = true; + static constexpr bool has_signaling_NaN = false; + static constexpr float_denorm_style has_denorm = denorm_present; + static constexpr bool has_denorm_loss = false; static boost::math::cstdfloat::detail::float_internal128_t infinity () { return BOOST_FLOAT128_C(1.0) / BOOST_FLOAT128_C(0.0); } static boost::math::cstdfloat::detail::float_internal128_t quiet_NaN () { return -(::BOOST_CSTDFLOAT_FLOAT128_SQRT(BOOST_FLOAT128_C(-1.0))); } static boost::math::cstdfloat::detail::float_internal128_t signaling_NaN() { return BOOST_FLOAT128_C(0.0); } static boost::math::cstdfloat::detail::float_internal128_t denorm_min () { return BOOST_CSTDFLOAT_FLOAT128_DENORM_MIN; } - BOOST_STATIC_CONSTEXPR bool is_iec559 = true; - BOOST_STATIC_CONSTEXPR bool is_bounded = true; - BOOST_STATIC_CONSTEXPR bool is_modulo = false; - BOOST_STATIC_CONSTEXPR bool traps = false; - BOOST_STATIC_CONSTEXPR bool tinyness_before = false; - BOOST_STATIC_CONSTEXPR float_round_style round_style = round_to_nearest; + static constexpr bool is_iec559 = true; + static constexpr bool is_bounded = true; + static constexpr bool is_modulo = false; + static constexpr bool traps = false; + static constexpr bool tinyness_before = false; + static constexpr float_round_style round_style = round_to_nearest; }; } // namespace std diff --git a/include/boost/math/distributions/hyperexponential.hpp b/include/boost/math/distributions/hyperexponential.hpp index 18830dc0f..68e1f37c4 100644 --- a/include/boost/math/distributions/hyperexponential.hpp +++ b/include/boost/math/distributions/hyperexponential.hpp @@ -15,8 +15,6 @@ #ifndef BOOST_MATH_DISTRIBUTIONS_HYPEREXPONENTIAL_HPP #define BOOST_MATH_DISTRIBUTIONS_HYPEREXPONENTIAL_HPP - -#include #include #include #include diff --git a/include/boost/math/interpolators/catmull_rom.hpp b/include/boost/math/interpolators/catmull_rom.hpp index 7b5c62af5..14d686180 100644 --- a/include/boost/math/interpolators/catmull_rom.hpp +++ b/include/boost/math/interpolators/catmull_rom.hpp @@ -14,11 +14,10 @@ #include #include #include -#include namespace std_workaround { -#if defined(__cpp_lib_nonmember_container_access) || (defined(BOOST_MSVC) && (BOOST_MSVC >= 1900)) +#if defined(__cpp_lib_nonmember_container_access) || (defined(_MSC_VER) && (_MSC_VER >= 1900)) using std::size; #else template @@ -27,7 +26,7 @@ namespace std_workaround { return c.size(); } template - inline constexpr std::size_t size(const T(&array)[N]) BOOST_NOEXCEPT + inline constexpr std::size_t size(const T(&array)[N]) noexcept { return N; } diff --git a/include/boost/math/special_functions/detail/bernoulli_details.hpp b/include/boost/math/special_functions/detail/bernoulli_details.hpp index 295f6f3cc..9d0426f75 100644 --- a/include/boost/math/special_functions/detail/bernoulli_details.hpp +++ b/include/boost/math/special_functions/detail/bernoulli_details.hpp @@ -7,10 +7,11 @@ #ifndef BOOST_MATH_BERNOULLI_DETAIL_HPP #define BOOST_MATH_BERNOULLI_DETAIL_HPP -#include #include #include #include +#include +#include #include #include #include @@ -157,13 +158,11 @@ struct bernoulli_initializer // initialize our dymanic table: // boost::math::bernoulli_b2n(2, Policy()); -#ifndef BOOST_NO_EXCEPTIONS + try{ -#endif boost::math::bernoulli_b2n(max_bernoulli_b2n::value + 1, Policy()); -#ifndef BOOST_NO_EXCEPTIONS } catch(const std::overflow_error&){} -#endif + boost::math::tangent_t2n(2, Policy()); } void force_instantiate()const{} @@ -202,18 +201,12 @@ struct fixed_vector : private std::allocator } ~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 allocator_type; typedef std::allocator_traits 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_MATH_ASSERT(n < m_used); return m_data[n]; } const T& operator[](unsigned n)const { BOOST_MATH_ASSERT(n < m_used); return m_data[n]; } @@ -223,7 +216,7 @@ struct fixed_vector : private std::allocator { if(n > m_capacity) { - BOOST_THROW_EXCEPTION(std::runtime_error("Exhausted storage for Bernoulli numbers.")); + BOOST_MATH_THROW_EXCEPTION(std::runtime_error("Exhausted storage for Bernoulli numbers.")); } for(unsigned i = m_used; i < n; ++i) new (m_data + i) T(val); @@ -246,9 +239,7 @@ class bernoulli_numbers_cache { public: bernoulli_numbers_cache() : m_overflow_limit((std::numeric_limits::max)()) -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_MATH_NO_ATOMIC_INT) , m_counter(0) -#endif , m_current_precision(boost::math::tools::digits()) {} @@ -398,53 +389,6 @@ public: } return out; } - #if !defined(BOOST_HAS_THREADS) - // - // Single threaded code, very simple: - // - if(m_current_precision < boost::math::tools::digits()) - { - bn.clear(); - tn.clear(); - m_intermediates.clear(); - m_current_precision = boost::math::tools::digits(); - } - if(start + n >= bn.size()) - { - std::size_t new_size = (std::min)((std::max)((std::max)(std::size_t(start + n), std::size_t(bn.size() + 20)), std::size_t(50)), std::size_t(bn.capacity())); - tangent_numbers_series(new_size); - } - - for(std::size_t i = (std::max)(std::size_t(max_bernoulli_b2n::value + 1), start); i < start + n; ++i) - { - *out = (i >= m_overflow_limit) ? policies::raise_overflow_error("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol) : bn[i]; - ++out; - } - #elif defined(BOOST_MATH_NO_ATOMIC_INT) - // - // We need to grab a mutex every time we get here, for both readers and writers: - // - std::lock_guard l(m_mutex); - if(m_current_precision < boost::math::tools::digits()) - { - bn.clear(); - tn.clear(); - m_intermediates.clear(); - m_current_precision = boost::math::tools::digits(); - } - if(start + n >= bn.size()) - { - std::size_t new_size = (std::min)((std::max)((std::max)(std::size_t(start + n), std::size_t(bn.size() + 20)), std::size_t(50)), std::size_t(bn.capacity())); - tangent_numbers_series(new_size); - } - - for(std::size_t i = (std::max)(std::size_t(max_bernoulli_b2n::value + 1), start); i < start + n; ++i) - { - *out = (i >= m_overflow_limit) ? policies::raise_overflow_error("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol) : bn[i]; - ++out; - } - - #else // // Double-checked locking pattern, lets us access cached already cached values // without locking: @@ -482,7 +426,6 @@ public: ++out; } - #endif return out; } @@ -525,69 +468,6 @@ public: } return out; } - #if !defined(BOOST_HAS_THREADS) - // - // Single threaded code, very simple: - // - if(m_current_precision < boost::math::tools::digits()) - { - bn.clear(); - tn.clear(); - m_intermediates.clear(); - m_current_precision = boost::math::tools::digits(); - } - if(start + n >= bn.size()) - { - std::size_t new_size = (std::min)((std::max)((std::max)(start + n, std::size_t(bn.size() + 20)), std::size_t(50)), std::size_t(bn.capacity())); - tangent_numbers_series(new_size); - } - - for(std::size_t i = start; i < start + n; ++i) - { - if(i >= m_overflow_limit) - *out = policies::raise_overflow_error("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol); - else - { - if(tools::max_value() * tangent_scale_factor() < tn[static_cast(i)]) - *out = policies::raise_overflow_error("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol); - else - *out = tn[static_cast(i)] / tangent_scale_factor(); - } - ++out; - } - #elif defined(BOOST_MATH_NO_ATOMIC_INT) - // - // We need to grab a mutex every time we get here, for both readers and writers: - // - std::lock_guard l(m_mutex); - if(m_current_precision < boost::math::tools::digits()) - { - bn.clear(); - tn.clear(); - m_intermediates.clear(); - m_current_precision = boost::math::tools::digits(); - } - if(start + n >= bn.size()) - { - std::size_t new_size = (std::min)((std::max)((std::max)(start + n, std::size_t(bn.size() + 20)), std::size_t(50)), std::size_t(bn.capacity())); - tangent_numbers_series(new_size); - } - - for(std::size_t i = start; i < start + n; ++i) - { - if(i >= m_overflow_limit) - *out = policies::raise_overflow_error("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol); - else - { - if(tools::max_value() * tangent_scale_factor() < tn[static_cast(i)]) - *out = policies::raise_overflow_error("boost::math::bernoulli_b2n<%1%>(std::size_t)", 0, T(i), pol); - else - *out = tn[static_cast(i)] / tangent_scale_factor(); - } - ++out; - } - - #else // // Double-checked locking pattern, lets us access cached already cached values // without locking: @@ -633,7 +513,6 @@ public: ++out; } - #endif return out; } @@ -647,15 +526,8 @@ private: std::vector m_intermediates; // The value at which we know overflow has already occurred for the Bn: std::size_t m_overflow_limit; -#if !defined(BOOST_HAS_THREADS) - int m_current_precision; -#elif defined(BOOST_MATH_NO_ATOMIC_INT) - std::mutex m_mutex; - int m_current_precision; -#else std::mutex m_mutex; atomic_counter_type m_counter, m_current_precision; -#endif }; template diff --git a/include/boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp b/include/boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp index 361d50683..4adc9f6a8 100644 --- a/include/boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp +++ b/include/boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp @@ -10,7 +10,7 @@ #define BOOST_MATH_DAUBECHIES_SCALING_INTEGER_GRID_HPP #include #include -#include +#include /* In order to keep the character count as small as possible and speed up compiler parsing times, we define a macro C_ which appends an appropriate @@ -22,7 +22,7 @@ The suffix is as follows: * Nothing otherwise. */ -#ifdef BOOST_HAS_FLOAT128 +#ifdef BOOST_MATH_USE_FLOAT128 # define C_(x) static_cast(x##Q) #elif (LDBL_MANT_DIG > DBL_MANT_DIG) # define C_(x) static_cast(x##L) diff --git a/include/boost/math/special_functions/detail/lambert_w_lookup_table.ipp b/include/boost/math/special_functions/detail/lambert_w_lookup_table.ipp index 4c48cdff5..b38aeb49c 100644 --- a/include/boost/math/special_functions/detail/lambert_w_lookup_table.ipp +++ b/include/boost/math/special_functions/detail/lambert_w_lookup_table.ipp @@ -21,29 +21,29 @@ namespace math { namespace lambert_w_detail { namespace lambert_w_lookup { -BOOST_STATIC_CONSTEXPR std::size_t noof_sqrts = 12; -BOOST_STATIC_CONSTEXPR std::size_t noof_halves = 12; -BOOST_STATIC_CONSTEXPR std::size_t noof_w0es = 65; -BOOST_STATIC_CONSTEXPR std::size_t noof_w0zs = 65; -BOOST_STATIC_CONSTEXPR std::size_t noof_wm1es = 64; -BOOST_STATIC_CONSTEXPR std::size_t noof_wm1zs = 64; +static constexpr std::size_t noof_sqrts = 12; +static constexpr std::size_t noof_halves = 12; +static constexpr std::size_t noof_w0es = 65; +static constexpr std::size_t noof_w0zs = 65; +static constexpr std::size_t noof_wm1es = 64; +static constexpr std::size_t noof_wm1zs = 64; -BOOST_STATIC_CONSTEXPR lookup_t halves[noof_halves] = +static constexpr lookup_t halves[noof_halves] = { // Common to Lambert W0 and W-1 (and exactly representable). 0.5L, 0.25L, 0.125L, 0.0625L, 0.03125L, 0.015625L, 0.0078125L, 0.00390625L, 0.001953125L, 0.0009765625L, 0.00048828125L, 0.000244140625L }; // halves, 0.5, 0.25, ... 0.000244140625, common to W0 and W-1. -BOOST_STATIC_CONSTEXPR lookup_t sqrtw0s[noof_sqrts] = +static constexpr lookup_t sqrtw0s[noof_sqrts] = { // For Lambert W0 only. 0.6065306597126334242631173765403218567L, 0.77880078307140486866846070009071995L, 0.882496902584595403104717592968701829L, 0.9394130628134757862473572557999761753L, 0.9692332344763440819139583751755278177L, 0.9844964370054084060204319075254540376L, 0.9922179382602435121227899136829802692L, 0.996101369470117490071323985506950379L, 0.9980487811074754727142805899944244847L, 0.9990239141819756622368328253791383317L, 0.9995118379398893653889967919448497792L, 0.9997558891748972165136242351259789505L }; // sqrtw0s -BOOST_STATIC_CONSTEXPR lookup_t sqrtwm1s[noof_sqrts] = +static constexpr lookup_t sqrtwm1s[noof_sqrts] = { // For Lambert W-1 only. 1.648721270700128146848650787814163572L, 1.284025416687741484073420568062436458L, 1.133148453066826316829007227811793873L, 1.064494458917859429563390594642889673L, 1.031743407499102670938747815281507144L, 1.015747708586685747458535072082351749L, 1.007843097206447977693453559760123579L, 1.003913889338347573443609603903460282L, 1.001955033591002812046518898047477216L, 1.000977039492416535242845292611606506L, 1.000488400478694473126173623807163354L, 1.000244170429747854937005233924135774L }; // sqrtwm1s -BOOST_STATIC_CONSTEXPR lookup_t w0es[noof_w0zs] = +static constexpr lookup_t w0es[noof_w0zs] = { // Fukushima e powers array e[0] = 2.718, 1., e[2] = e^-1 = 0.135, e[3] = e^-2 = 0.133 ... e[64] = 4.3596100000630809736231248158884615452e-28. 2.7182818284590452353602874713526624978e+00L, 1.0000000000000000000000000000000000000e+00L, 3.6787944117144232159552377016146086745e-01L, 1.3533528323661269189399949497248440341e-01L, 4.9787068367863942979342415650061776632e-02L, @@ -65,7 +65,7 @@ BOOST_STATIC_CONSTEXPR lookup_t w0es[noof_w0zs] = }; // w0es -BOOST_STATIC_CONSTEXPR lookup_t w0zs[noof_w0zs] = +static constexpr lookup_t w0zs[noof_w0zs] = { // z values for W[0], W[1], W[2] ... W[64] (Fukushima array Fk). 0.0000000000000000000000000000000000000e+00L, 2.7182818284590452353602874713526624978e+00L, 1.4778112197861300454460854921150015626e+01L, 6.0256610769563003222785588963745153691e+01L, 2.1839260013257695631244104481144351361e+02L, @@ -87,7 +87,7 @@ BOOST_STATIC_CONSTEXPR lookup_t w0zs[noof_w0zs] = }; // w0zs -BOOST_STATIC_CONSTEXPR lookup_t wm1es[noof_wm1es] = +static constexpr lookup_t wm1es[noof_wm1es] = { // Fukushima e array e[0] = e^1 = 2.718, e[1] = e^2 = 7.39 ... e[64] = 4.60718e+28. 2.7182818284590452353602874713526624978e+00L, 7.3890560989306502272304274605750078132e+00L, 2.0085536923187667740928529654581717897e+01L, 5.4598150033144239078110261202860878403e+01L, 1.4841315910257660342111558004055227962e+02L, @@ -108,7 +108,7 @@ BOOST_STATIC_CONSTEXPR lookup_t wm1es[noof_wm1es] = 8.4383566687414544890733294803731179601e+26L, 2.2937831594696098790993528402686136005e+27L, 6.2351490808116168829092387089284697448e+27L }; // wm1es -BOOST_STATIC_CONSTEXPR lookup_t wm1zs[noof_wm1zs] = +static constexpr lookup_t wm1zs[noof_wm1zs] = { // Fukushima G array of z values for integral K, (Fukushima Gk) g[0] (k = -1) = 1 ... g[64] = -1.0264389699511303e-26. -3.6787944117144232159552377016146086745e-01L, -2.7067056647322538378799898994496880682e-01L, -1.4936120510359182893802724695018532990e-01L, -7.3262555554936721174872085092964968848e-02L, -3.3689734995427335483180242115742121244e-02L, diff --git a/include/boost/math/special_functions/detail/round_fwd.hpp b/include/boost/math/special_functions/detail/round_fwd.hpp index 8c45a7d75..c58459e36 100644 --- a/include/boost/math/special_functions/detail/round_fwd.hpp +++ b/include/boost/math/special_functions/detail/round_fwd.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_MATH_SPECIAL_ROUND_FWD_HPP #define BOOST_MATH_SPECIAL_ROUND_FWD_HPP -#include +#include #include #ifdef _MSC_VER @@ -32,12 +32,10 @@ namespace boost long ltrunc(const T& v, const Policy& pol); template long ltrunc(const T& v); -#ifdef BOOST_HAS_LONG_LONG template - boost::long_long_type lltrunc(const T& v, const Policy& pol); + long long lltrunc(const T& v, const Policy& pol); template - boost::long_long_type lltrunc(const T& v); -#endif + long long lltrunc(const T& v); template typename tools::promote_args::type round(const T& v, const Policy& pol); template @@ -50,12 +48,10 @@ namespace boost long lround(const T& v, const Policy& pol); template long lround(const T& v); -#ifdef BOOST_HAS_LONG_LONG template - boost::long_long_type llround(const T& v, const Policy& pol); + long long llround(const T& v, const Policy& pol); template - boost::long_long_type llround(const T& v); -#endif + long long llround(const T& v); template T modf(const T& v, T* ipart, const Policy& pol); template @@ -68,13 +64,10 @@ namespace boost T modf(const T& v, long* ipart, const Policy& pol); template T modf(const T& v, long* ipart); -#ifdef BOOST_HAS_LONG_LONG template - T modf(const T& v, boost::long_long_type* ipart, const Policy& pol); + T modf(const T& v, long long* ipart, const Policy& pol); template - T modf(const T& v, boost::long_long_type* ipart); -#endif - + T modf(const T& v, long long* ipart); } } diff --git a/include/boost/math/special_functions/gamma.hpp b/include/boost/math/special_functions/gamma.hpp index ef26bf6b0..6b96e1898 100644 --- a/include/boost/math/special_functions/gamma.hpp +++ b/include/boost/math/special_functions/gamma.hpp @@ -14,11 +14,12 @@ #pragma once #endif -#include #include #include #include #include +#include +#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include #include #include @@ -1465,7 +1465,6 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, result = pow(x, a) / (a); else { -#ifndef BOOST_NO_EXCEPTIONS try { result = pow(x, a) / boost::math::tgamma(a + 1, pol); @@ -1474,9 +1473,6 @@ T gamma_incomplete_imp(T a, T x, bool normalised, bool invert, { result = 0; } -#else - result = pow(x, a) / boost::math::tgamma(a + 1, pol); -#endif } result *= 1 - a * x / (a + 1); if (p_derivative) diff --git a/include/boost/math/special_functions/hypergeometric_1F1.hpp b/include/boost/math/special_functions/hypergeometric_1F1.hpp index d15f46c5c..6bac6a2b8 100644 --- a/include/boost/math/special_functions/hypergeometric_1F1.hpp +++ b/include/boost/math/special_functions/hypergeometric_1F1.hpp @@ -10,12 +10,7 @@ #ifndef BOOST_MATH_HYPERGEOMETRIC_1F1_HPP #define BOOST_MATH_HYPERGEOMETRIC_1F1_HPP -#include - -#if defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || defined(BOOST_NO_CXX11_LAMBDAS) || defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) -# error "hypergeometric_1F1 requires a C++11 compiler" -#endif - +#include #include #include #include @@ -590,13 +585,8 @@ namespace boost { namespace math { namespace detail { // // Actual result will be result * e^log_scaling. // -#ifndef BOOST_NO_CXX11_THREAD_LOCAL - static const thread_local long long max_scaling = lltrunc(boost::math::tools::log_max_value()) - 2; - static const thread_local T max_scale_factor = exp(T(max_scaling)); -#else - long long max_scaling = lltrunc(boost::math::tools::log_max_value()) - 2; - T max_scale_factor = exp(T(max_scaling)); -#endif + static const thread_local long long max_scaling = lltrunc(boost::math::tools::log_max_value()) - 2; + static const thread_local T max_scale_factor = exp(T(max_scaling)); while (log_scaling > max_scaling) { @@ -634,15 +624,11 @@ namespace boost { namespace math { namespace detail { // // Actual result will be result * e^log_scaling / tgamma(b). // - int result_sign = 1; - T scale = log_scaling - boost::math::lgamma(b, &result_sign, pol); -#ifndef BOOST_NO_CXX11_THREAD_LOCAL + int result_sign = 1; + T scale = log_scaling - boost::math::lgamma(b, &result_sign, pol); + static const thread_local T max_scaling = boost::math::tools::log_max_value() - 2; - static const thread_local T max_scale_factor = exp(max_scaling); -#else - T max_scaling = boost::math::tools::log_max_value() - 2; - T max_scale_factor = exp(max_scaling); -#endif + static const thread_local T max_scale_factor = exp(max_scaling); while (scale > max_scaling) { diff --git a/include/boost/math/special_functions/hypergeometric_pFq.hpp b/include/boost/math/special_functions/hypergeometric_pFq.hpp index ac9625307..338d2300b 100644 --- a/include/boost/math/special_functions/hypergeometric_pFq.hpp +++ b/include/boost/math/special_functions/hypergeometric_pFq.hpp @@ -8,12 +8,6 @@ #ifndef BOOST_MATH_HYPERGEOMETRIC_PFQ_HPP #define BOOST_MATH_HYPERGEOMETRIC_PFQ_HPP -#include - -#if defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || defined(BOOST_NO_CXX11_LAMBDAS) || defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) || defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || defined(BOOST_NO_CXX11_HDR_CHRONO) -# error "hypergeometric_pFq requires a C++11 compiler" -#endif - #include #include #include diff --git a/include/boost/math/special_functions/lanczos.hpp b/include/boost/math/special_functions/lanczos.hpp index 4d4aed1ad..fbbf447e7 100644 --- a/include/boost/math/special_functions/lanczos.hpp +++ b/include/boost/math/special_functions/lanczos.hpp @@ -10,7 +10,7 @@ #pragma once #endif -#include +#include #include #include #include @@ -3212,18 +3212,6 @@ struct lanczos58MP : public std::integral_constant // struct undefined_lanczos : public std::integral_constant::max)() - 1> { }; -#if 0 -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS -#define BOOST_MATH_FLT_DIGITS ::std::numeric_limits::digits -#define BOOST_MATH_DBL_DIGITS ::std::numeric_limits::digits -#define BOOST_MATH_LDBL_DIGITS ::std::numeric_limits::digits -#else -#define BOOST_MATH_FLT_DIGITS FLT_MANT_DIG -#define BOOST_MATH_DBL_DIGITS DBL_MANT_DIG -#define BOOST_MATH_LDBL_DIGITS LDBL_MANT_DIG -#endif -#endif - template struct lanczos { diff --git a/include/boost/math/special_functions/sinhc.hpp b/include/boost/math/special_functions/sinhc.hpp index ffe8e4805..6606ad3ea 100644 --- a/include/boost/math/special_functions/sinhc.hpp +++ b/include/boost/math/special_functions/sinhc.hpp @@ -15,7 +15,6 @@ #pragma once #endif -#include #include #include #include @@ -23,8 +22,6 @@ #include #include -#include - // These are the the "Hyperbolic Sinus Cardinal" functions. namespace boost @@ -38,15 +35,9 @@ namespace boost template inline T sinhc_pi_imp(const T x) { -#if defined(BOOST_NO_STDC_NAMESPACE) && !defined(__SUNPRO_CC) - using ::abs; - using ::sinh; - using ::sqrt; -#else /* BOOST_NO_STDC_NAMESPACE */ using ::std::abs; using ::std::sinh; using ::std::sqrt; -#endif /* BOOST_NO_STDC_NAMESPACE */ static T const taylor_0_bound = tools::epsilon(); static T const taylor_2_bound = sqrt(taylor_0_bound); @@ -94,22 +85,12 @@ namespace boost return boost::math::sinhc_pi(x); } -#ifdef BOOST_NO_TEMPLATE_TEMPLATES -#else /* BOOST_NO_TEMPLATE_TEMPLATES */ template class U> inline U sinhc_pi(const U x) { -#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) || defined(__GNUC__) - using namespace std; -#elif defined(BOOST_NO_STDC_NAMESPACE) && !defined(__SUNPRO_CC) - using ::abs; - using ::sinh; - using ::sqrt; -#else /* BOOST_NO_STDC_NAMESPACE */ - using ::std::abs; - using ::std::sinh; - using ::std::sqrt; -#endif /* BOOST_NO_STDC_NAMESPACE */ + using std::abs; + using std::sinh; + using std::sqrt; using ::std::numeric_limits; @@ -147,7 +128,6 @@ namespace boost return(result); } } -#endif /* BOOST_NO_TEMPLATE_TEMPLATES */ } } diff --git a/include/boost/math/statistics/univariate_statistics.hpp b/include/boost/math/statistics/univariate_statistics.hpp index f4c6d3236..08587a3b3 100644 --- a/include/boost/math/statistics/univariate_statistics.hpp +++ b/include/boost/math/statistics/univariate_statistics.hpp @@ -8,7 +8,7 @@ #define BOOST_MATH_STATISTICS_UNIVARIATE_STATISTICS_HPP #include -#include +#include #include #include #include diff --git a/include/boost/math/tools/atomic.hpp b/include/boost/math/tools/atomic.hpp index cef4aae43..4ea3c1d85 100644 --- a/include/boost/math/tools/atomic.hpp +++ b/include/boost/math/tools/atomic.hpp @@ -7,14 +7,10 @@ #ifndef BOOST_MATH_ATOMIC_DETAIL_HPP #define BOOST_MATH_ATOMIC_DETAIL_HPP -#include #include -#ifdef BOOST_HAS_THREADS - -#ifndef BOOST_NO_CXX11_HDR_ATOMIC -# include -# define BOOST_MATH_ATOMIC_NS std +#include +#define BOOST_MATH_ATOMIC_NS std namespace boost { namespace math { namespace detail { @@ -44,12 +40,4 @@ namespace boost { } }} -#endif // BOOST_NO_CXX11_HDR_ATOMIC - -#else // BOOST_HAS_THREADS - -# define BOOST_MATH_NO_ATOMIC_INT - -#endif // BOOST_HAS_THREADS - #endif // BOOST_MATH_ATOMIC_DETAIL_HPP diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 0e63a64c1..bbe9a0883 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -242,7 +242,7 @@ struct non_type {}; // // And then the actual configuration: // -#if defined(_GLIBCXX_USE_FLOAT128) && defined(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) && !defined(__STRICT_ANSI__) \ +#if defined(_GLIBCXX_USE_FLOAT128) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) && !defined(__STRICT_ANSI__) \ && !defined(BOOST_MATH_DISABLE_FLOAT128) || defined(BOOST_MATH_USE_FLOAT128) // // Only enable this when the compiler really is GCC as clang and probably diff --git a/include/boost/math/tools/convert_from_string.hpp b/include/boost/math/tools/convert_from_string.hpp index 5091ca144..01f7669e4 100644 --- a/include/boost/math/tools/convert_from_string.hpp +++ b/include/boost/math/tools/convert_from_string.hpp @@ -32,7 +32,7 @@ namespace boost{ namespace math{ namespace tools{ #endif } template - constexpr const char* convert_from_string(const char* p, const std::true_type&) BOOST_NOEXCEPT + constexpr const char* convert_from_string(const char* p, const std::true_type&) noexcept { return p; } diff --git a/include/boost/math/tools/cxx03_warn.hpp b/include/boost/math/tools/cxx03_warn.hpp index 57c5ea4f4..2db6ec7d1 100644 --- a/include/boost/math/tools/cxx03_warn.hpp +++ b/include/boost/math/tools/cxx03_warn.hpp @@ -6,6 +6,8 @@ #ifndef BOOST_MATH_TOOLS_CXX03_WARN_HPP #define BOOST_MATH_TOOLS_CXX03_WARN_HPP +#include + #if defined(BOOST_NO_CXX11_NOEXCEPT) # define BOOST_MATH_SHOW_CXX03_WARNING # define BOOST_MATH_CXX03_WARN_REASON "BOOST_NO_CXX11_NOEXCEPT" diff --git a/include/boost/math/tools/detail/is_const_iterable.hpp b/include/boost/math/tools/detail/is_const_iterable.hpp index 0726ce90e..e5efc82c3 100644 --- a/include/boost/math/tools/detail/is_const_iterable.hpp +++ b/include/boost/math/tools/detail/is_const_iterable.hpp @@ -6,11 +6,8 @@ #ifndef BOOST_MATH_TOOLS_IS_CONST_ITERABLE_HPP #define BOOST_MATH_TOOLS_IS_CONST_ITERABLE_HPP -#include #include -#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) - #define BOOST_MATH_HAS_IS_CONST_ITERABLE #include @@ -38,6 +35,4 @@ namespace boost { } } } } -#endif - #endif // BOOST_MATH_TOOLS_IS_CONST_ITERABLE_HPP diff --git a/include/boost/math/tools/polynomial.hpp b/include/boost/math/tools/polynomial.hpp index 635bcf668..8e8e8422b 100644 --- a/include/boost/math/tools/polynomial.hpp +++ b/include/boost/math/tools/polynomial.hpp @@ -14,7 +14,7 @@ #endif #include -#include +#include #include #include #include @@ -123,7 +123,7 @@ namespace detail { * subtlety of distinction. */ template -BOOST_DEDUCED_TYPENAME std::enable_if::is_integer, void >::type +typename std::enable_if::is_integer, void >::type division_impl(polynomial &q, polynomial &u, const polynomial& v, N n, N k) { q[k] = u[n + k] / v[n]; @@ -166,7 +166,7 @@ T integer_power(T t, N n) * don't currently have that subtlety of distinction. */ template -BOOST_DEDUCED_TYPENAME std::enable_if::is_integer, void >::type +typename std::enable_if::is_integer, void >::type division_impl(polynomial &q, polynomial &u, const polynomial& v, N n, N k) { q[k] = u[n + k] * integer_power(v[n], k); @@ -311,7 +311,7 @@ public: } // move: - polynomial(polynomial&& p) BOOST_NOEXCEPT + polynomial(polynomial&& p) noexcept : m_data(std::move(p.m_data)) { } // copy: @@ -423,7 +423,7 @@ public: } // operators: - polynomial& operator =(polynomial&& p) BOOST_NOEXCEPT + polynomial& operator =(polynomial&& p) noexcept { m_data = std::move(p.m_data); return *this; @@ -549,19 +549,10 @@ public: } // Conversion to bool. -#ifdef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS - typedef bool (polynomial::*unmentionable_type)() const; - - BOOST_FORCEINLINE operator unmentionable_type() const - { - return is_zero() ? false : &polynomial::is_zero; - } -#else - BOOST_FORCEINLINE explicit operator bool() const + inline explicit operator bool() const { return !m_data.empty(); } -#endif // Fast way to set a polynomial to zero. void set_zero() diff --git a/include/boost/math/tools/tuple.hpp b/include/boost/math/tools/tuple.hpp index ce0698b2a..b5e42fc59 100644 --- a/include/boost/math/tools/tuple.hpp +++ b/include/boost/math/tools/tuple.hpp @@ -5,7 +5,7 @@ #ifndef BOOST_MATH_TUPLE_HPP_INCLUDED #define BOOST_MATH_TUPLE_HPP_INCLUDED -#include + #include #include diff --git a/include/boost/math/tools/workaround.hpp b/include/boost/math/tools/workaround.hpp index 29ce8b1c0..8ec0f000d 100644 --- a/include/boost/math/tools/workaround.hpp +++ b/include/boost/math/tools/workaround.hpp @@ -26,7 +26,7 @@ inline T fmod_workaround(T a, T b) BOOST_MATH_NOEXCEPT(T) } #if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106)) template <> -inline long double fmod_workaround(long double a, long double b) BOOST_NOEXCEPT +inline long double fmod_workaround(long double a, long double b) noexcept { return ::fmodl(a, b); } diff --git a/test/test_autodiff.hpp b/test/test_autodiff.hpp index 818f39e15..ab6ef9672 100644 --- a/test/test_autodiff.hpp +++ b/test/test_autodiff.hpp @@ -75,7 +75,7 @@ template struct test_constants_t { static constexpr auto n_samples = if_t, bmp::is_number_expression>, mp11::mp_int<10>, mp11::mp_int<25>>::value; static constexpr auto order = OrderValue; - static constexpr T pct_epsilon() BOOST_NOEXCEPT { + static constexpr T pct_epsilon() noexcept { return (is_multiprecision_t::value ? 2 : 1) * std::numeric_limits::epsilon() * 100; } }; diff --git a/test/test_constants.cpp b/test/test_constants.cpp index 7b37b7d2e..b96ad03a8 100644 --- a/test/test_constants.cpp +++ b/test/test_constants.cpp @@ -77,7 +77,7 @@ inline int itrunc(const big_real_concept& val) namespace tools{ template <> -inline constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_NOEXCEPT +inline constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept { return 2 * boost::math::constants::max_string_digits; } diff --git a/tools/lambert_w_lookup_table_generator.cpp b/tools/lambert_w_lookup_table_generator.cpp index ef86af181..8a50c7198 100644 --- a/tools/lambert_w_lookup_table_generator.cpp +++ b/tools/lambert_w_lookup_table_generator.cpp @@ -34,17 +34,17 @@ using boost::multiprecision::cpp_bin_float_50; /* typedef double lookup_t; // Type for lookup table (double or float?) -BOOST_STATIC_CONSTEXPR std::size_t noof_sqrts = 12; -BOOST_STATIC_CONSTEXPR lookup_t a[noof_sqrts] = // 0.6065 0.7788, 0.8824 ... 0.9997, sqrt of previous elements. +static constexpr std::size_t noof_sqrts = 12; +static constexpr lookup_t a[noof_sqrts] = // 0.6065 0.7788, 0.8824 ... 0.9997, sqrt of previous elements. { 0.60653065971263342, 0.77880078307140487, 0.8824969025845954, 0.93941306281347579, 0.96923323447634408, 0.98449643700540841, 0.99221793826024351, 0.99610136947011749, 0.99804878110747547, 0.99902391418197566, 0.99951183793988937, 0.99975588917489722 }; -BOOST_STATIC_CONSTEXPR lookup_t b[noof_sqrts] = // 0.5 0.25 0.125, 0.0625 ... 0.0002441, halves of previous elements. +static constexpr lookup_t b[noof_sqrts] = // 0.5 0.25 0.125, 0.0625 ... 0.0002441, halves of previous elements. { 0.5, 0.25, 0.125, 0.0625, 0.03125, 0.015625, 0.0078125, 0.00390625, 0.001953125, 0.0009765625, 0.00048828125, 0.000244140625 }; -BOOST_STATIC_CONSTEXPR size_t noof_w0zs = 65; -BOOST_STATIC_CONSTEXPR lookup_t g[noof_w0zs] = // lambert_w[k] for W0 branch. 0 2.7182 14.77 60.2566 ... 1.445e+29 3.990e+29. +static constexpr size_t noof_w0zs = 65; +static constexpr lookup_t g[noof_w0zs] = // lambert_w[k] for W0 branch. 0 2.7182 14.77 60.2566 ... 1.445e+29 3.990e+29. { 0., 2.7182818284590452, 14.7781121978613, 60.256610769563003, 218.39260013257696, 742.06579551288302, 2420.5727609564107, 7676.4321089992102, 23847.663896333826, 72927.755348178456, 220264.65794806717, 658615.558867176, 1953057.4970280471, 5751374.0961159665, 16836459.978306875, 49035260.58708166, 142177768.32812596, 410634196.81078007, 1181879444.4719492, 3391163718.300558, 9703303908.1958056, 27695130424.147509, 78868082614.895014, 224130479263.72476, @@ -57,8 +57,8 @@ BOOST_STATIC_CONSTEXPR lookup_t g[noof_w0zs] = // lambert_w[k] for W0 branch. 0 5.2317811346197018e+28, 1.4450833904658542e+29, 3.9904954117194348e+29 }; -BOOST_STATIC_CONSTEXPR std::size_t noof_wm1zs = 66; -BOOST_STATIC_CONSTEXPR lookup_t e[noof_wm1zs] = // lambert_w[k] for W-1 branch. 2.7182 1. 0.3678 0.1353 0.04978 ... 4.359e-28 1.603e-28 +static constexpr std::size_t noof_wm1zs = 66; +static constexpr lookup_t e[noof_wm1zs] = // lambert_w[k] for W-1 branch. 2.7182 1. 0.3678 0.1353 0.04978 ... 4.359e-28 1.603e-28 { 2.7182818284590452, 1., 0.36787944117144232, 0.13533528323661269, 0.049787068367863943, 0.01831563888873418, 0.0067379469990854671, 0.0024787521766663584, 0.00091188196555451621, 0.00033546262790251184, 0.00012340980408667955, 4.5399929762484852e-05, 1.6701700790245659e-05, @@ -171,20 +171,20 @@ int main() fout << "\nnamespace boost {\nnamespace math {\nnamespace lambert_w_detail {\nnamespace lambert_w_lookup\n{ \n"; - BOOST_STATIC_CONSTEXPR std::size_t noof_sqrts = 12; - BOOST_STATIC_CONSTEXPR std::size_t noof_halves = 12; - fout << "BOOST_STATIC_CONSTEXPR std::size_t noof_sqrts = " << noof_sqrts << ";" << std::endl; - fout << "BOOST_STATIC_CONSTEXPR std::size_t noof_halves = " << noof_halves << ";" << std::endl; // Common to both branches. + static constexpr std::size_t noof_sqrts = 12; + static constexpr std::size_t noof_halves = 12; + fout << "static constexpr std::size_t noof_sqrts = " << noof_sqrts << ";" << std::endl; + fout << "static constexpr std::size_t noof_halves = " << noof_halves << ";" << std::endl; // Common to both branches. - BOOST_STATIC_CONSTEXPR std::size_t noof_w0zs = 65; // F[k] 0 <= k <= 64. f[0] = F[0], f[64] = F[64] - BOOST_STATIC_CONSTEXPR std::size_t noof_w0es = 66; // noof_w0zs +1 for gratuitous extra power. - BOOST_STATIC_CONSTEXPR std::size_t noof_wm1zs = 64; // G[k] 1 <= k <= 64. (W-1 = 0 would be z = -infinity, so not stored in array) g[0] == G[1], g[63] = G[64] - BOOST_STATIC_CONSTEXPR std::size_t noof_wm1es = 64; // + static constexpr std::size_t noof_w0zs = 65; // F[k] 0 <= k <= 64. f[0] = F[0], f[64] = F[64] + static constexpr std::size_t noof_w0es = 66; // noof_w0zs +1 for gratuitous extra power. + static constexpr std::size_t noof_wm1zs = 64; // G[k] 1 <= k <= 64. (W-1 = 0 would be z = -infinity, so not stored in array) g[0] == G[1], g[63] = G[64] + static constexpr std::size_t noof_wm1es = 64; // - fout << "BOOST_STATIC_CONSTEXPR std::size_t noof_w0es = " << noof_w0zs << ";" << std::endl; - fout << "BOOST_STATIC_CONSTEXPR std::size_t noof_w0zs = " << noof_w0zs << ";" << std::endl; - fout << "BOOST_STATIC_CONSTEXPR std::size_t noof_wm1es = " << noof_wm1zs << ";" << std::endl; - fout << "BOOST_STATIC_CONSTEXPR std::size_t noof_wm1zs = " << noof_wm1zs << ";" << std::endl; + fout << "static constexpr std::size_t noof_w0es = " << noof_w0zs << ";" << std::endl; + fout << "static constexpr std::size_t noof_w0zs = " << noof_w0zs << ";" << std::endl; + fout << "static constexpr std::size_t noof_wm1es = " << noof_wm1zs << ";" << std::endl; + fout << "static constexpr std::size_t noof_wm1zs = " << noof_wm1zs << ";" << std::endl; // Defining actual lookup table sqrts of e^k, e^-k = 1/e, etc. table_lookup_t halves[noof_halves]; // 0.5 0.25 0.125, 0.0625 ... 0.0002441, halves of previous elements. @@ -306,11 +306,11 @@ int main() } // for j // Output values as C++ arrays, - // using BOOST_STATIC_CONSTEXPR as static and constexpr as possible for platform. + // using static constexpr as static and constexpr as possible for platform. fout << std::noshowpoint; // Do show NOT trailing zeros for halves and sqrts values. fout << - "\n" "BOOST_STATIC_CONSTEXPR lookup_t halves[noof_halves] = " // + "\n" "static constexpr lookup_t halves[noof_halves] = " // "\n" "{ // Common to Lambert W0 and W-1 (and exactly representable)." << "\n "; for (int i = 0; i != noof_halves; i++) { @@ -327,7 +327,7 @@ int main() fout << "}; // halves, 0.5, 0.25, ... 0.000244140625, common to W0 and W-1." << std::endl; fout << - "\n" "BOOST_STATIC_CONSTEXPR lookup_t sqrtw0s[noof_sqrts] = " // + "\n" "static constexpr lookup_t sqrtw0s[noof_sqrts] = " // "\n" "{ // For Lambert W0 only." << "\n "; for (int i = 0; i != noof_sqrts; i++) { @@ -344,7 +344,7 @@ int main() fout << "}; // sqrtw0s" << std::endl; fout << - "\n" "BOOST_STATIC_CONSTEXPR lookup_t sqrtwm1s[noof_sqrts] = " // + "\n" "static constexpr lookup_t sqrtwm1s[noof_sqrts] = " // "\n" "{ // For Lambert W-1 only." << "\n "; for (int i = 0; i != noof_sqrts; i++) { @@ -367,7 +367,7 @@ int main() fout << // W0 e values. // Fukushima code generates an extra unused power, but it is not output by using noof_w0zs instead of noof_w0es. - "\n" "BOOST_STATIC_CONSTEXPR lookup_t w0es[noof_w0zs] = " // + "\n" "static constexpr lookup_t w0es[noof_w0zs] = " // "\n" "{ // Fukushima e powers array e[0] = 2.718, 1., e[2] = e^-1 = 0.135, e[3] = e^-2 = 0.133 ... e[64] = 4.3596100000630809736231248158884615452e-28." << "\n "; for (int i = 0; i != noof_w0zs; i++) { @@ -384,7 +384,7 @@ int main() fout << "\n}; // w0es" << std::endl; fout << // W0 z values for W[1], . - "\n" "BOOST_STATIC_CONSTEXPR lookup_t w0zs[noof_w0zs] = " // + "\n" "static constexpr lookup_t w0zs[noof_w0zs] = " // "\n" "{ // z values for W[0], W[1], W[2] ... W[64] (Fukushima array Fk). " << "\n "; for (int i = 0; i != noof_w0zs; i++) { @@ -403,7 +403,7 @@ int main() // Two arrays for w-1 fout << // W-1 e values. - "\n" "BOOST_STATIC_CONSTEXPR lookup_t wm1es[noof_wm1es] = " // + "\n" "static constexpr lookup_t wm1es[noof_wm1es] = " // "\n" "{ // Fukushima e array e[0] = e^1 = 2.718, e[1] = e^2 = 7.39 ... e[64] = 4.60718e+28." << "\n "; for (int i = 0; i != noof_wm1es; i++) { @@ -420,7 +420,7 @@ int main() fout << "\n}; // wm1es" << std::endl; fout << // Wm1 z values for integral K. - "\n" "BOOST_STATIC_CONSTEXPR lookup_t wm1zs[noof_wm1zs] = " // + "\n" "static constexpr lookup_t wm1zs[noof_wm1zs] = " // "\n" "{ // Fukushima G array of z values for integral K, (Fukushima Gk) g[0] (k = -1) = 1 ... g[64] = -1.0264389699511303e-26." << "\n "; for (int i = 0; i != noof_wm1zs; i++) {