Skip to content

Commit 16a91de

Browse files
committed
Disable standalone tests of cstdfloat concept
[standalone]
1 parent 3c34470 commit 16a91de

File tree

6 files changed

+26
-11
lines changed

6 files changed

+26
-11
lines changed

include/boost/math/tools/ulps_plot.hpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414
#include <string>
1515
#include <list>
1616
#include <random>
17+
#include <limits>
1718
#include <stdexcept>
1819
#include <boost/math/tools/condition_numbers.hpp>
19-
#include <boost/random/uniform_real_distribution.hpp>
2020

21+
#ifndef BOOST_MATH_STANDALONE
22+
#include <boost/random/uniform_real_distribution.hpp>
23+
#endif
2124

2225
// Design of this function comes from:
2326
// https://blogs.mathworks.com/cleve/2017/01/23/ulps-plots-reveal-math-function-accurary/
@@ -496,8 +499,16 @@ ulps_plot<F, PreciseReal, CoarseReal>::ulps_plot(F hi_acc_impl, CoarseReal a, Co
496499
std::random_device rd;
497500
gen.seed(rd());
498501
}
502+
499503
// Boost's uniform_real_distribution can generate quad and multiprecision random numbers; std's cannot:
504+
#ifndef BOOST_MATH_STANDALONE
500505
boost::random::uniform_real_distribution<PreciseReal> dis(static_cast<PreciseReal>(a), static_cast<PreciseReal>(b));
506+
#else
507+
// Use std::random in standalone mode if it is a type that the standard library can support (float, double, or long double)
508+
static_assert(std::numeric_limits<PreciseReal>::digits10 <= std::numeric_limits<long double>::digits10, "Standalone mode does not support types with precision that exceeds long double");
509+
std::uniform_real_distribution<PreciseReal> dis(static_cast<PreciseReal>(a), static_cast<PreciseReal>(b));
510+
#endif
511+
501512
precise_abscissas_.resize(samples);
502513
coarse_abscissas_.resize(samples);
503514

test/compile_test/cstdfloat_concept_check_1.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// Boost Software License, Version 1.0. (See accompanying file
44
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
55

6+
#ifndef BOOST_MATH_STANDALONE
7+
68
#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false
79

810
#include <boost/cstdfloat.hpp>
@@ -21,3 +23,4 @@ int main(int
2123
#endif
2224
}
2325

26+
#endif

test/compile_test/cstdfloat_concept_check_2.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
// Boost Software License, Version 1.0. (See accompanying file
44
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
55

6+
#ifndef BOOST_MATH_STANDALONE
7+
68
#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false
79

810
#include <boost/cstdfloat.hpp>
911
#include "poison.hpp"
1012
#include "instantiate.hpp"
1113

12-
1314
int main(int
1415
#ifdef BOOST_FLOAT80_C
1516
argc
@@ -22,3 +23,4 @@ int main(int
2223
#endif
2324
}
2425

26+
#endif

test/compile_test/cstdfloat_concept_check_3.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// Boost Software License, Version 1.0. (See accompanying file
44
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
55

6+
#ifndef BOOST_MATH_STANDALONE
7+
68
#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false
79

810
#include <boost/cstdfloat.hpp>
@@ -22,3 +24,4 @@ int main(int
2224
#endif
2325
}
2426

27+
#endif

test/compile_test/cstdfloat_concept_check_4.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// Boost Software License, Version 1.0. (See accompanying file
44
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
55

6+
#ifndef BOOST_MATH_STANDALONE
7+
68
#define BOOST_MATH_ASSERT_UNDEFINED_POLICY false
79

810
#include <boost/cstdfloat.hpp>
@@ -22,3 +24,4 @@ int main(int
2224
#endif
2325
}
2426

27+
#endif

test/compile_test/poison.hpp

+2-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// we basically need to include every std lib header we use, otherwise
1515
// our poisoned macros can break legit std lib code.
1616
//
17-
#include <boost/config.hpp>
1817
#include <valarray>
1918
#include <complex>
2019
#include <iosfwd>
@@ -39,18 +38,10 @@
3938
#include <memory>
4039
#include <cerrno>
4140
#include <functional>
42-
#ifndef BOOST_NO_CXX11_HDR_FUTURE
4341
#include <future>
44-
#endif
45-
#ifndef BOOST_NO_CXX11_HDR_THREAD
4642
#include <thread>
47-
#endif
48-
#ifndef BOOST_NO_CXX11_HDR_RANDOM
4943
#include <random>
50-
#endif
51-
#ifndef BOOST_NO_CXX11_HDR_CHRONO
5244
#include <chrono>
53-
#endif
5445
#include <map>
5546

5647
//
@@ -61,7 +52,9 @@
6152
//
6253
// lexical_cast uses macro unsafe isinf etc, so we have to include this as well:
6354
//
55+
#ifndef BOOST_MATH_STANDALONE
6456
#include <boost/lexical_cast.hpp>
57+
#endif
6558

6659
//
6760
// Poison all the function-like macros in C99 so if we accidentally call them

0 commit comments

Comments
 (0)