From 83d7b1a50da0cced9deec4f7279ff3f0f5c9b930 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 30 Jun 2025 13:59:00 -0400 Subject: [PATCH 1/2] Add macOS long double to fp_traits for double precision --- .../special_functions/detail/fp_traits.hpp | 26 ++----------------- 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/include/boost/math/special_functions/detail/fp_traits.hpp b/include/boost/math/special_functions/detail/fp_traits.hpp index 015ea9cd35..ae6d8c647c 100644 --- a/include/boost/math/special_functions/detail/fp_traits.hpp +++ b/include/boost/math/special_functions/detail/fp_traits.hpp @@ -270,7 +270,7 @@ template<> struct fp_traits_non_native // long double (64 bits) ------------------------------------------------------- #if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)\ - || defined(BOOST_BORLANDC) || defined(__CODEGEAR__) + || defined(BOOST_BORLANDC) || defined(__CODEGEAR__) || (defined(__APPLE__) && defined(__aarch64__)) template<> struct fp_traits_non_native { @@ -297,31 +297,9 @@ template<> struct fp_traits_non_native static constexpr int offset_ = BOOST_MATH_ENDIAN_BIG_BYTE ? 0 : 4; }; -//.............................................................................. - -#else - -template<> struct fp_traits_non_native -{ - typedef ieee_copy_all_bits_tag method; - - static const uint64_t sign = static_cast(0x80000000u) << 32; - static const uint64_t exponent = static_cast(0x7ff00000) << 32; - static const uint64_t flag = 0; - static const uint64_t significand - = (static_cast(0x000fffff) << 32) + static_cast(0xffffffffu); - - typedef uint64_t bits; - static void get_bits(long double x, uint64_t& a) { std::memcpy(&a, &x, 8); } - static void set_bits(long double& x, uint64_t a) { std::memcpy(&x, &a, 8); } -}; - -#endif - - // long double (>64 bits), x86 and x64 ----------------------------------------- -#if defined(__i386) || defined(__i386__) || defined(_M_IX86) \ +#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) \ || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) \ || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) From 008a31c8ef10c219cbc7db49ade4aad354020872 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 3 Jul 2025 08:58:41 -0400 Subject: [PATCH 2/2] MSVC also uses 64-bit long doubles --- include/boost/math/special_functions/detail/fp_traits.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/math/special_functions/detail/fp_traits.hpp b/include/boost/math/special_functions/detail/fp_traits.hpp index ae6d8c647c..051b84c1e8 100644 --- a/include/boost/math/special_functions/detail/fp_traits.hpp +++ b/include/boost/math/special_functions/detail/fp_traits.hpp @@ -270,7 +270,7 @@ template<> struct fp_traits_non_native // long double (64 bits) ------------------------------------------------------- #if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)\ - || defined(BOOST_BORLANDC) || defined(__CODEGEAR__) || (defined(__APPLE__) && defined(__aarch64__)) + || defined(BOOST_BORLANDC) || defined(__CODEGEAR__) || (defined(__APPLE__) && defined(__aarch64__)) || defined(_MSC_VER) template<> struct fp_traits_non_native {