Skip to content

Commit 085da47

Browse files
authored
Merge pull request #1102 from boostorg/1098
Add dual-standalone test case
2 parents 1af0826 + b18c636 commit 085da47

File tree

4 files changed

+33
-11
lines changed

4 files changed

+33
-11
lines changed

include/boost/math/special_functions/detail/fp_traits.hpp

-10
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,6 @@ With these techniques, the code could be simplified.
3434
#define BOOST_MATH_ENDIAN_BIG_BYTE BOOST_ENDIAN_BIG_BYTE
3535
#define BOOST_MATH_ENDIAN_LITTLE_BYTE BOOST_ENDIAN_LITTLE_BYTE
3636

37-
#elif (__cplusplus >= 202002L || _MSVC_LANG >= 202002L)
38-
39-
#if __has_include(<bit>)
40-
#include <bit>
41-
#define BOOST_MATH_ENDIAN_BIG_BYTE (std::endian::native == std::endian::big)
42-
#define BOOST_MATH_ENDIAN_LITTLE_BYTE (std::endian::native == std::endian::little)
43-
#else
44-
#error Missing <bit> header. Please disable standalone mode, and file an issue at https://github.com/boostorg/math
45-
#endif
46-
4737
#elif defined(_WIN32)
4838

4939
#define BOOST_MATH_ENDIAN_BIG_BYTE 0

include/boost/math/tools/config.hpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333

3434
// The following are all defined as standalone macros as well
3535
// If Boost.Config is available just use those definitions because they are more fine-grained
36-
#define BOOST_MATH_PREVENT_MACRO_SUBSTITUTION BOOST_PREVENT_MACRO_SUBSTITUTION
36+
37+
// Could be defined in TR1
38+
#ifndef BOOST_MATH_PREVENT_MACRO_SUBSTITUTION
39+
# define BOOST_MATH_PREVENT_MACRO_SUBSTITUTION BOOST_PREVENT_MACRO_SUBSTITUTION
40+
#endif
3741

3842
#define BOOST_MATH_CXX14_CONSTEXPR BOOST_CXX14_CONSTEXPR
3943
#ifdef BOOST_NO_CXX14_CONSTEXPR

test/Jamfile.v2

+1
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ test-suite mp :
893893
[ run polynomial_concept_check.cpp ]
894894

895895
[ run issue893.cpp ]
896+
[ run git_issue_1098.cpp ]
896897
;
897898

898899
test-suite misc :

test/git_issue_1098.cpp

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright Matt Borland 2024.
2+
// Use, modification and distribution are subject to the
3+
// Boost Software License, Version 1.0. (See accompanying file
4+
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5+
6+
#define BOOST_MATH_STANDALONE
7+
#define BOOST_MP_STANDALONE
8+
9+
#include <boost/config.hpp>
10+
#include <boost/math/distributions/uniform.hpp>
11+
#include <boost/multiprecision/cpp_bin_float.hpp>
12+
#include <type_traits>
13+
14+
int main()
15+
{
16+
using T = boost::multiprecision::cpp_bin_float_quad;
17+
18+
// This macro should be available through MP standalone since it bundles config
19+
BOOST_IF_CONSTEXPR (std::is_same<T, boost::multiprecision::cpp_bin_float_quad>::value)
20+
{
21+
boost::math::uniform_distribution<boost::multiprecision::cpp_bin_float_quad> d {0, 1};
22+
const auto q = boost::math::quantile(d, T(0.5));
23+
BOOST_MATH_ASSERT(q == T(0.5));
24+
}
25+
26+
return 0;
27+
}

0 commit comments

Comments
 (0)