2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 16:32:10 +00:00

Merge pull request #1102 from boostorg/1098

Add dual-standalone test case
This commit is contained in:
Matt Borland
2024-02-26 08:16:53 +01:00
committed by GitHub
4 changed files with 33 additions and 11 deletions

View File

@@ -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(<bit>)
#include <bit>
#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 <bit> 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

View File

@@ -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

View File

@@ -893,6 +893,7 @@ test-suite mp :
[ run polynomial_concept_check.cpp ]
[ run issue893.cpp ]
[ run git_issue_1098.cpp ]
;
test-suite misc :

27
test/git_issue_1098.cpp Normal file
View File

@@ -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 <boost/config.hpp>
#include <boost/math/distributions/uniform.hpp>
#include <boost/multiprecision/cpp_bin_float.hpp>
#include <type_traits>
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<T, boost::multiprecision::cpp_bin_float_quad>::value)
{
boost::math::uniform_distribution<boost::multiprecision::cpp_bin_float_quad> d {0, 1};
const auto q = boost::math::quantile(d, T(0.5));
BOOST_MATH_ASSERT(q == T(0.5));
}
return 0;
}