mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
Remove <boost/limits.hpp>
This commit is contained in:
@@ -11,7 +11,8 @@
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
#include <boost/limits.hpp>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <boost/math/tools/config.hpp>
|
||||
#include <boost/math/tools/series.hpp>
|
||||
#include <boost/math/tools/precision.hpp>
|
||||
@@ -127,7 +128,7 @@ T expm1_imp(T x, const std::integral_constant<int, 0>&, const Policy& pol)
|
||||
if(a < tools::epsilon<T>())
|
||||
return x;
|
||||
detail::expm1_series<T> s(x);
|
||||
boost::uintmax_t max_iter = policies::get_max_series_iterations<Policy>();
|
||||
std::uintmax_t max_iter = policies::get_max_series_iterations<Policy>();
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x582)) && !BOOST_WORKAROUND(__EDG_VERSION__, <= 245)
|
||||
T result = tools::sum_series(s, policies::get_epsilon<T, Policy>(), max_iter);
|
||||
#else
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
#include <boost/limits.hpp>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <boost/math/tools/config.hpp>
|
||||
#include <boost/math/tools/series.hpp>
|
||||
#include <boost/math/tools/rational.hpp>
|
||||
@@ -99,7 +100,7 @@ T log1p_imp(T const & x, const Policy& pol, const std::integral_constant<int, 0>
|
||||
if(a < tools::epsilon<result_type>())
|
||||
return x;
|
||||
detail::log1p_series<result_type> s(x);
|
||||
boost::uintmax_t max_iter = policies::get_max_series_iterations<Policy>();
|
||||
std::uintmax_t max_iter = policies::get_max_series_iterations<Policy>();
|
||||
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x582)) && !BOOST_WORKAROUND(__EDG_VERSION__, <= 245)
|
||||
result_type result = tools::sum_series(s, policies::get_epsilon<result_type, Policy>(), max_iter);
|
||||
#else
|
||||
@@ -475,7 +476,7 @@ inline typename tools::promote_args<T>::type
|
||||
return -x * x / 2;
|
||||
boost::math::detail::log1p_series<T> s(x);
|
||||
s();
|
||||
boost::uintmax_t max_iter = policies::get_max_series_iterations<Policy>();
|
||||
std::uintmax_t max_iter = policies::get_max_series_iterations<Policy>();
|
||||
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x582))
|
||||
T zero = 0;
|
||||
T result = boost::math::tools::sum_series(s, policies::get_epsilon<T, Policy>(), max_iter, zero);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/math/tools/assert.hpp>
|
||||
#include <boost/math/policies/policy.hpp>
|
||||
#include <type_traits>
|
||||
@@ -37,7 +36,7 @@ namespace tools
|
||||
// See Conceptual Requirements for Real Number Types.
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_NOEXCEPT
|
||||
inline constexpr int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept
|
||||
{
|
||||
static_assert( ::std::numeric_limits<T>::is_specialized, "Type T must be specialized");
|
||||
static_assert( ::std::numeric_limits<T>::radix == 2 || ::std::numeric_limits<T>::radix == 10, "Type T must have a radix of 2 or 10");
|
||||
@@ -48,7 +47,7 @@ inline BOOST_MATH_CONSTEXPR int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
static_assert( ::std::numeric_limits<T>::is_specialized, "Type T must be specialized");
|
||||
return (std::numeric_limits<T>::max)();
|
||||
@@ -56,7 +55,7 @@ inline BOOST_MATH_CONSTEXPR T max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) B
|
||||
// -max_value<double> = -1.79769e+308, max_value<double> = 1.79769e+308.
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
static_assert( ::std::numeric_limits<T>::is_specialized, "Type T must be specialized");
|
||||
|
||||
@@ -73,13 +72,13 @@ namespace detail{
|
||||
// For type float first:
|
||||
//
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T log_max_value(const std::integral_constant<int, 128>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T log_max_value(const std::integral_constant<int, 128>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return 88.0f;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T log_min_value(const std::integral_constant<int, 128>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T log_min_value(const std::integral_constant<int, 128>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return -87.0f;
|
||||
}
|
||||
@@ -87,13 +86,13 @@ inline BOOST_MATH_CONSTEXPR T log_min_value(const std::integral_constant<int, 12
|
||||
// Now double:
|
||||
//
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T log_max_value(const std::integral_constant<int, 1024>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T log_max_value(const std::integral_constant<int, 1024>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return 709.0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T log_min_value(const std::integral_constant<int, 1024>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T log_min_value(const std::integral_constant<int, 1024>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return -708.0;
|
||||
}
|
||||
@@ -101,13 +100,13 @@ inline BOOST_MATH_CONSTEXPR T log_min_value(const std::integral_constant<int, 10
|
||||
// 80 and 128-bit long doubles:
|
||||
//
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T log_max_value(const std::integral_constant<int, 16384>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T log_max_value(const std::integral_constant<int, 16384>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return 11356.0L;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T log_min_value(const std::integral_constant<int, 16384>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T log_min_value(const std::integral_constant<int, 16384>& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return -11355.0L;
|
||||
}
|
||||
@@ -139,14 +138,14 @@ inline T log_min_value(const std::integral_constant<int, 0>& BOOST_MATH_APPEND_E
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T epsilon(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return std::numeric_limits<T>::epsilon();
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106))
|
||||
template <>
|
||||
inline BOOST_MATH_CONSTEXPR long double epsilon<long double>(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(long double)) BOOST_MATH_NOEXCEPT(long double)
|
||||
inline constexpr long double epsilon<long double>(const std::true_type& BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(long double)) noexcept(long double)
|
||||
{
|
||||
// numeric_limits on Darwin (and elsewhere) tells lies here:
|
||||
// the issue is that long double on a few platforms is
|
||||
@@ -191,7 +190,7 @@ template <class T, bool b> struct log_limit_noexcept_traits_imp : public log_lim
|
||||
template <class T> struct log_limit_noexcept_traits_imp<T, false> : public std::integral_constant<bool, false> {};
|
||||
|
||||
template <class T>
|
||||
struct log_limit_noexcept_traits : public log_limit_noexcept_traits_imp<T, BOOST_MATH_IS_FLOAT(T)> {};
|
||||
struct log_limit_noexcept_traits : public log_limit_noexcept_traits_imp<T, std::is_floating_point<T>::value> {};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -201,7 +200,7 @@ struct log_limit_noexcept_traits : public log_limit_noexcept_traits_imp<T, BOOST
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_NOEXCEPT_IF(detail::log_limit_noexcept_traits<T>::value)
|
||||
inline constexpr T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept_IF(detail::log_limit_noexcept_traits<T>::value)
|
||||
{
|
||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
return detail::log_max_value<T>(typename detail::log_limit_traits<T>::tag_type());
|
||||
@@ -214,7 +213,7 @@ inline BOOST_MATH_CONSTEXPR T log_max_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_NOEXCEPT_IF(detail::log_limit_noexcept_traits<T>::value)
|
||||
inline constexpr T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) noexcept_IF(detail::log_limit_noexcept_traits<T>::value)
|
||||
{
|
||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
return detail::log_min_value<T>(typename detail::log_limit_traits<T>::tag_type());
|
||||
@@ -231,7 +230,7 @@ inline BOOST_MATH_CONSTEXPR T log_min_value(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T)) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
return detail::epsilon<T>(std::integral_constant<bool, ::std::numeric_limits<T>::is_specialized>());
|
||||
@@ -245,25 +244,25 @@ inline BOOST_MATH_CONSTEXPR T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(T))
|
||||
namespace detail{
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T root_epsilon_imp(const std::integral_constant<int, 24>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T root_epsilon_imp(const std::integral_constant<int, 24>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(0.00034526698300124390839884978618400831996329879769945L);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T root_epsilon_imp(const T*, const std::integral_constant<int, 53>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T root_epsilon_imp(const T*, const std::integral_constant<int, 53>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(0.1490116119384765625e-7L);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T root_epsilon_imp(const T*, const std::integral_constant<int, 64>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T root_epsilon_imp(const T*, const std::integral_constant<int, 64>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(0.32927225399135962333569506281281311031656150598474e-9L);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T root_epsilon_imp(const T*, const std::integral_constant<int, 113>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T root_epsilon_imp(const T*, const std::integral_constant<int, 113>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(0.1387778780781445675529539585113525390625e-16L);
|
||||
}
|
||||
@@ -284,25 +283,25 @@ inline T root_epsilon_imp(const T*, const std::integral_constant<int, 0>&)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T cbrt_epsilon_imp(const std::integral_constant<int, 24>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T cbrt_epsilon_imp(const std::integral_constant<int, 24>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(0.0049215666011518482998719164346805794944150447839903L);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T cbrt_epsilon_imp(const T*, const std::integral_constant<int, 53>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T cbrt_epsilon_imp(const T*, const std::integral_constant<int, 53>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(6.05545445239333906078989272793696693569753008995e-6L);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T cbrt_epsilon_imp(const T*, const std::integral_constant<int, 64>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T cbrt_epsilon_imp(const T*, const std::integral_constant<int, 64>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(4.76837158203125e-7L);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T cbrt_epsilon_imp(const T*, const std::integral_constant<int, 113>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T cbrt_epsilon_imp(const T*, const std::integral_constant<int, 113>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(5.7749313854154005630396773604745549542403508090496e-12L);
|
||||
}
|
||||
@@ -323,25 +322,25 @@ inline T cbrt_epsilon_imp(const T*, const std::integral_constant<int, 0>&)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T forth_root_epsilon_imp(const T*, const std::integral_constant<int, 24>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T forth_root_epsilon_imp(const T*, const std::integral_constant<int, 24>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(0.018581361171917516667460937040007436176452688944747L);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T forth_root_epsilon_imp(const T*, const std::integral_constant<int, 53>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T forth_root_epsilon_imp(const T*, const std::integral_constant<int, 53>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(0.0001220703125L);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T forth_root_epsilon_imp(const T*, const std::integral_constant<int, 64>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T forth_root_epsilon_imp(const T*, const std::integral_constant<int, 64>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(0.18145860519450699870567321328132261891067079047605e-4L);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T forth_root_epsilon_imp(const T*, const std::integral_constant<int, 113>&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T forth_root_epsilon_imp(const T*, const std::integral_constant<int, 113>&) noexcept(std::is_floating_point<T>::value)
|
||||
{
|
||||
return static_cast<T>(0.37252902984619140625e-8L);
|
||||
}
|
||||
@@ -371,19 +370,19 @@ struct root_epsilon_traits
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T root_epsilon() BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(T) && detail::root_epsilon_traits<T>::has_noexcept)
|
||||
inline constexpr T root_epsilon() noexcept(std::is_floating_point<T>::value && detail::root_epsilon_traits<T>::has_noexcept)
|
||||
{
|
||||
return detail::root_epsilon_imp(static_cast<T const*>(0), typename detail::root_epsilon_traits<T>::tag_type());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T cbrt_epsilon() BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(T) && detail::root_epsilon_traits<T>::has_noexcept)
|
||||
inline constexpr T cbrt_epsilon() noexcept(std::is_floating_point<T>::value && detail::root_epsilon_traits<T>::has_noexcept)
|
||||
{
|
||||
return detail::cbrt_epsilon_imp(static_cast<T const*>(0), typename detail::root_epsilon_traits<T>::tag_type());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T forth_root_epsilon() BOOST_NOEXCEPT_IF(BOOST_MATH_IS_FLOAT(T) && detail::root_epsilon_traits<T>::has_noexcept)
|
||||
inline constexpr T forth_root_epsilon() noexcept(std::is_floating_point<T>::value && detail::root_epsilon_traits<T>::has_noexcept)
|
||||
{
|
||||
return detail::forth_root_epsilon_imp(static_cast<T const*>(0), typename detail::root_epsilon_traits<T>::tag_type());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user