2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Add workaround for std::float64_t in large constants.

This commit is contained in:
jzmaddock
2025-04-12 12:38:54 +01:00
parent de452a3fad
commit 8e5df72a92
2 changed files with 6 additions and 2 deletions

View File

@@ -80,11 +80,15 @@ inline constexpr T make_big_value(largest_float, const char* s, std::false_type
//
// For constants which might fit in a long double (if it's big enough):
//
// Note that gcc-13 has std::is_convertible<long double, std::float64_t>::value false, likewise
// std::is_constructible<std::float64_t, long double>::value, even though the conversions do
// actually work. Workaround is the || std::is_floating_point<T>::value part which thankfully is true.
//
#define BOOST_MATH_BIG_CONSTANT(T, D, x)\
boost::math::tools::make_big_value<T>(\
BOOST_MATH_LARGEST_FLOAT_C(x), \
BOOST_MATH_STRINGIZE(x), \
std::integral_constant<bool, (std::is_convertible<boost::math::tools::largest_float, T>::value) && \
std::integral_constant<bool, (std::is_convertible<boost::math::tools::largest_float, T>::value || std::is_floating_point<T>::value) && \
((D <= boost::math::tools::numeric_traits<boost::math::tools::largest_float>::digits) \
|| std::is_floating_point<T>::value \
|| (boost::math::tools::numeric_traits<T>::is_specialized && \

View File

@@ -118,7 +118,7 @@ inline T create_test_value(largest_float, const char* str, const std::false_type
std::numeric_limits<T>::is_specialized &&\
(std::numeric_limits<T>::radix == 2)\
&& (std::numeric_limits<T>::digits <= BOOST_MATH_TEST_LARGEST_FLOAT_DIGITS)\
&& std::is_convertible<largest_float, T>::value>(),\
&& (std::is_convertible<largest_float, T>::value || std::is_floating_point<T>::value)>(),\
std::integral_constant<bool, \
std::is_constructible<T, const char*>::value>()\
)