From b390d093df7edef55a5e93d02201a2c3231bc79d Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Tue, 13 Jan 2026 12:09:13 +0000 Subject: [PATCH 1/4] Update fptraits.hpp for gcc/windows/aarch64. Also adds better error checking. Fixes #1348 --- .../math/special_functions/detail/fp_traits.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 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 051b84c1e8..c6b46ef66f 100644 --- a/include/boost/math/special_functions/detail/fp_traits.hpp +++ b/include/boost/math/special_functions/detail/fp_traits.hpp @@ -24,6 +24,7 @@ With these techniques, the code could be simplified. #include #include #include +#include #include #include #include @@ -270,7 +271,10 @@ 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(_MSC_VER) + || defined(BOOST_BORLANDC) || defined(__CODEGEAR__) || (defined(__APPLE__) && defined(__aarch64__)) || defined(_MSC_VER)\ + || (defined(__GNUC__) && defined(__aarch64__)) + +static_assert(LDBL_MANT_DIG == 53, "Oops, assumption that long double is a 64-bit quantity is incorrect!!"); template<> struct fp_traits_non_native { @@ -305,6 +309,8 @@ template<> struct fp_traits_non_native // Intel extended double precision format (80 bits) +static_assert(LDBL_MANT_DIG == 64, "Oops, assumption that long double is an 80-bit quantity is incorrect!!"); + template<> struct fp_traits_non_native { @@ -356,6 +362,8 @@ struct fp_traits_non_native // PowerPC extended double precision format (128 bits) +static_assert(LDBL_MANT_DIG == 113, "Oops, assumption that long double is a 128-bit quantity is incorrect!!"); + template<> struct fp_traits_non_native { @@ -430,6 +438,8 @@ struct fp_traits_non_native // IEEE extended double precision format with 15 exponent bits (128 bits) +static_assert(LDBL_MANT_DIG == 113, "Oops, assumption that long double is a 128-bit quantity is incorrect!!"); + template<> struct fp_traits_non_native { From 0c9bbf6b55434b5094535bcb3e10068650a847ea Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 16 Jan 2026 12:37:42 +0000 Subject: [PATCH 2/4] fptraits.hpp: Update tests for arm64 and CUDA. --- 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 c6b46ef66f..925e26cce6 100644 --- a/include/boost/math/special_functions/detail/fp_traits.hpp +++ b/include/boost/math/special_functions/detail/fp_traits.hpp @@ -272,7 +272,7 @@ template<> struct fp_traits_non_native #if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)\ || defined(BOOST_BORLANDC) || defined(__CODEGEAR__) || (defined(__APPLE__) && defined(__aarch64__)) || defined(_MSC_VER)\ - || (defined(__GNUC__) && defined(__aarch64__)) + || (defined(__GNUC__) && defined(__aarch64__) && defined(_WIN32)) || defined(BOOST_MATH_HAS_GPU_SUPPORT) static_assert(LDBL_MANT_DIG == 53, "Oops, assumption that long double is a 64-bit quantity is incorrect!!"); From 37daf3e9e2732a03c2f8cc74a87ac6255b51844f Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 20 Jan 2026 12:44:30 -0500 Subject: [PATCH 3/4] Remove GPU specific check --- 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 925e26cce6..a199eebd11 100644 --- a/include/boost/math/special_functions/detail/fp_traits.hpp +++ b/include/boost/math/special_functions/detail/fp_traits.hpp @@ -272,7 +272,7 @@ template<> struct fp_traits_non_native #if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)\ || defined(BOOST_BORLANDC) || defined(__CODEGEAR__) || (defined(__APPLE__) && defined(__aarch64__)) || defined(_MSC_VER)\ - || (defined(__GNUC__) && defined(__aarch64__) && defined(_WIN32)) || defined(BOOST_MATH_HAS_GPU_SUPPORT) + || (defined(__GNUC__) && defined(__aarch64__) && defined(_WIN32)) static_assert(LDBL_MANT_DIG == 53, "Oops, assumption that long double is a 64-bit quantity is incorrect!!"); From 935e699a0cedb5c1a7876a7d2e4c9d5166692893 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Tue, 20 Jan 2026 13:10:14 -0500 Subject: [PATCH 4/4] Only check SYCL 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 a199eebd11..015f8c6a34 100644 --- a/include/boost/math/special_functions/detail/fp_traits.hpp +++ b/include/boost/math/special_functions/detail/fp_traits.hpp @@ -272,7 +272,7 @@ template<> struct fp_traits_non_native #if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)\ || defined(BOOST_BORLANDC) || defined(__CODEGEAR__) || (defined(__APPLE__) && defined(__aarch64__)) || defined(_MSC_VER)\ - || (defined(__GNUC__) && defined(__aarch64__) && defined(_WIN32)) + || (defined(__GNUC__) && defined(__aarch64__) && defined(_WIN32)) || defined(__SYCL_DEVICE_ONLY__) static_assert(LDBL_MANT_DIG == 53, "Oops, assumption that long double is a 64-bit quantity is incorrect!!");