update boost
This commit is contained in:
@@ -8,10 +8,13 @@
|
||||
#define BOOST_MATH_TOOLS_BIG_CONSTANT_HPP
|
||||
|
||||
#include <boost/math/tools/config.hpp>
|
||||
#ifndef BOOST_MATH_NO_LEXICAL_CAST
|
||||
#ifndef BOOST_MATH_STANDALONE
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#endif
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <type_traits>
|
||||
#include <limits>
|
||||
|
||||
namespace boost{ namespace math{
|
||||
|
||||
@@ -31,30 +34,39 @@ struct numeric_traits<__float128>
|
||||
static const int max_exponent = 16384;
|
||||
static const bool is_specialized = true;
|
||||
};
|
||||
#else
|
||||
#elif LDBL_DIG > DBL_DIG
|
||||
typedef long double largest_float;
|
||||
#define BOOST_MATH_LARGEST_FLOAT_C(x) x##L
|
||||
#else
|
||||
typedef double largest_float;
|
||||
#define BOOST_MATH_LARGEST_FLOAT_C(x) x
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline BOOST_CONSTEXPR_OR_CONST T make_big_value(largest_float v, const char*, mpl::true_ const&, mpl::false_ const&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::false_type const&) BOOST_MATH_NOEXCEPT(T)
|
||||
{
|
||||
return static_cast<T>(v);
|
||||
}
|
||||
template <class T>
|
||||
inline BOOST_CONSTEXPR_OR_CONST T make_big_value(largest_float v, const char*, mpl::true_ const&, mpl::true_ const&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T make_big_value(largest_float v, const char*, std::true_type const&, std::true_type const&) BOOST_MATH_NOEXCEPT(T)
|
||||
{
|
||||
return static_cast<T>(v);
|
||||
}
|
||||
#ifndef BOOST_MATH_NO_LEXICAL_CAST
|
||||
template <class T>
|
||||
inline T make_big_value(largest_float, const char* s, mpl::false_ const&, mpl::false_ const&)
|
||||
inline T make_big_value(largest_float, const char* s, std::false_type const&, std::false_type const&)
|
||||
{
|
||||
return boost::lexical_cast<T>(s);
|
||||
}
|
||||
#else
|
||||
template <typename T>
|
||||
inline T make_big_value(largest_float, const char* s, std::false_type const&, std::false_type const&)
|
||||
{
|
||||
static_assert(sizeof(T) == 0, "Type is unsupported in standalone mode. Please disable and try again.");
|
||||
}
|
||||
#endif
|
||||
template <class T>
|
||||
inline BOOST_MATH_CONSTEXPR T make_big_value(largest_float, const char* s, mpl::false_ const&, mpl::true_ const&) BOOST_MATH_NOEXCEPT(T)
|
||||
inline constexpr T make_big_value(largest_float, const char* s, std::false_type const&, std::true_type const&) BOOST_MATH_NOEXCEPT(T)
|
||||
{
|
||||
return T(s);
|
||||
}
|
||||
@@ -66,19 +78,19 @@ inline BOOST_MATH_CONSTEXPR T make_big_value(largest_float, const char* s, mpl::
|
||||
boost::math::tools::make_big_value<T>(\
|
||||
BOOST_MATH_LARGEST_FLOAT_C(x), \
|
||||
BOOST_STRINGIZE(x), \
|
||||
mpl::bool_< (is_convertible<boost::math::tools::largest_float, T>::value) && \
|
||||
std::integral_constant<bool, (std::is_convertible<boost::math::tools::largest_float, T>::value) && \
|
||||
((D <= boost::math::tools::numeric_traits<boost::math::tools::largest_float>::digits) \
|
||||
|| is_floating_point<T>::value \
|
||||
|| std::is_floating_point<T>::value \
|
||||
|| (boost::math::tools::numeric_traits<T>::is_specialized && \
|
||||
(boost::math::tools::numeric_traits<T>::digits10 <= boost::math::tools::numeric_traits<boost::math::tools::largest_float>::digits10))) >(), \
|
||||
boost::is_convertible<const char*, T>())
|
||||
std::is_constructible<T, const char*>())
|
||||
//
|
||||
// For constants too huge for any conceivable long double (and which generate compiler errors if we try and declare them as such):
|
||||
//
|
||||
#define BOOST_MATH_HUGE_CONSTANT(T, D, x)\
|
||||
boost::math::tools::make_big_value<T>(0.0L, BOOST_STRINGIZE(x), \
|
||||
mpl::bool_<is_floating_point<T>::value || (boost::math::tools::numeric_traits<T>::is_specialized && boost::math::tools::numeric_traits<T>::max_exponent <= boost::math::tools::numeric_traits<boost::math::tools::largest_float>::max_exponent && boost::math::tools::numeric_traits<T>::digits <= boost::math::tools::numeric_traits<boost::math::tools::largest_float>::digits)>(), \
|
||||
boost::is_constructible<const char*, T>())
|
||||
std::integral_constant<bool, std::is_floating_point<T>::value || (boost::math::tools::numeric_traits<T>::is_specialized && boost::math::tools::numeric_traits<T>::max_exponent <= boost::math::tools::numeric_traits<boost::math::tools::largest_float>::max_exponent && boost::math::tools::numeric_traits<T>::digits <= boost::math::tools::numeric_traits<boost::math::tools::largest_float>::digits)>(), \
|
||||
std::is_constructible<T, const char*>())
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
|
||||
Reference in New Issue
Block a user