From 08a2fe6368335f103c0db1968f5414d52cb88b06 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 23 Feb 2024 08:22:03 +0100 Subject: [PATCH 1/4] Add dual-standalone test case --- test/Jamfile.v2 | 1 + test/git_issue_1098.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/git_issue_1098.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index f8ba2e889..cce2a8fcf 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -893,6 +893,7 @@ test-suite mp : [ run polynomial_concept_check.cpp ] [ run issue893.cpp ] + [ run git_issue_1098.cpp ] ; test-suite misc : diff --git a/test/git_issue_1098.cpp b/test/git_issue_1098.cpp new file mode 100644 index 000000000..2f48ceeba --- /dev/null +++ b/test/git_issue_1098.cpp @@ -0,0 +1,27 @@ +// Copyright Matt Borland 2024. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#define BOOST_MATH_STANDALONE +#define BOOST_MP_STANDALONE + +#include +#include +#include +#include + +int main() +{ + using T = boost::multiprecision::cpp_bin_float_quad; + + // This macro should be available through MP standalone since it bundles config + BOOST_IF_CONSTEXPR (std::is_same::value) + { + boost::math::uniform_distribution d {0, 1}; + const auto q = boost::math::quantile(d, T(0.5)); + assert(q == T(0.5)); + } + + return 0; +} From b31e90fd1c8d666cb7cb04ea737cfc7e3f2bcfaf Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 23 Feb 2024 10:04:49 +0100 Subject: [PATCH 2/4] Replace assert with BOOST_MATH_ASSERT --- test/git_issue_1098.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/git_issue_1098.cpp b/test/git_issue_1098.cpp index 2f48ceeba..0d6029225 100644 --- a/test/git_issue_1098.cpp +++ b/test/git_issue_1098.cpp @@ -20,7 +20,7 @@ int main() { boost::math::uniform_distribution d {0, 1}; const auto q = boost::math::quantile(d, T(0.5)); - assert(q == T(0.5)); + BOOST_MATH_ASSERT(q == T(0.5)); } return 0; From c810edfab61687b03d54528eff31c0bee09c199b Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 23 Feb 2024 10:06:01 +0100 Subject: [PATCH 3/4] Fix TR1 macro redefintion --- include/boost/math/tools/config.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/boost/math/tools/config.hpp b/include/boost/math/tools/config.hpp index 0e75eb5e6..28d0d7a55 100644 --- a/include/boost/math/tools/config.hpp +++ b/include/boost/math/tools/config.hpp @@ -33,7 +33,11 @@ // The following are all defined as standalone macros as well // If Boost.Config is available just use those definitions because they are more fine-grained -#define BOOST_MATH_PREVENT_MACRO_SUBSTITUTION BOOST_PREVENT_MACRO_SUBSTITUTION + +// Could be defined in TR1 +#ifndef BOOST_MATH_PREVENT_MACRO_SUBSTITUTION +# define BOOST_MATH_PREVENT_MACRO_SUBSTITUTION BOOST_PREVENT_MACRO_SUBSTITUTION +#endif #define BOOST_MATH_CXX14_CONSTEXPR BOOST_CXX14_CONSTEXPR #ifdef BOOST_NO_CXX14_CONSTEXPR From b18c6363641c7bf7c638d9bd8342039079df9f81 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Fri, 23 Feb 2024 10:07:39 +0100 Subject: [PATCH 4/4] Remove unneeded byte order path --- .../boost/math/special_functions/detail/fp_traits.hpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/boost/math/special_functions/detail/fp_traits.hpp b/include/boost/math/special_functions/detail/fp_traits.hpp index 975052b52..2947a32a2 100644 --- a/include/boost/math/special_functions/detail/fp_traits.hpp +++ b/include/boost/math/special_functions/detail/fp_traits.hpp @@ -34,16 +34,6 @@ With these techniques, the code could be simplified. #define BOOST_MATH_ENDIAN_BIG_BYTE BOOST_ENDIAN_BIG_BYTE #define BOOST_MATH_ENDIAN_LITTLE_BYTE BOOST_ENDIAN_LITTLE_BYTE -#elif (__cplusplus >= 202002L || _MSVC_LANG >= 202002L) - -#if __has_include() -#include -#define BOOST_MATH_ENDIAN_BIG_BYTE (std::endian::native == std::endian::big) -#define BOOST_MATH_ENDIAN_LITTLE_BYTE (std::endian::native == std::endian::little) -#else -#error Missing header. Please disable standalone mode, and file an issue at https://github.com/boostorg/math -#endif - #elif defined(_WIN32) #define BOOST_MATH_ENDIAN_BIG_BYTE 0