2
0
mirror of https://github.com/boostorg/math.git synced 2026-02-25 16:32:15 +00:00

Merge branch 'compilance' into develop

This commit is contained in:
pabristow
2019-08-29 14:31:20 +01:00
69 changed files with 524 additions and 374 deletions

View File

@@ -1,4 +1,8 @@
//
// Copyright John Maddock 2018
// Distributed under 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)
// This test file exists to output diagnostic info for tests failing in the online matrix
// for perplexing reasons, it's contents are subject to constant change!!
//

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2008.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -3,6 +3,7 @@
// Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_MATH_TEST_TEST_HPP
#define BOOST_MATH_TEST_TEST_HPP
#include <atomic>
@@ -13,7 +14,6 @@
#include <boost/math/special_functions/next.hpp>
#include <boost/core/demangle.hpp>
namespace boost { namespace math { namespace test {
namespace detail {
@@ -39,7 +39,7 @@ bool check_mollified_close(Real expected, Real computed, Real tol, std::string c
}
using std::max;
using std::abs;
Real denom = max(abs(expected), Real(1));
Real denom = (max)(abs(expected), Real(1));
Real mollified_relative_error = abs(expected - computed)/denom;
if (mollified_relative_error > tol)
{
@@ -92,7 +92,7 @@ bool check_ulp_close(PreciseReal expected1, Real computed, size_t ulps, std::str
if (dist > ulps)
{
detail::total_ulp_distance += static_cast<int64_t>(dist);
Real denom = max(abs(expected), Real(1));
Real denom = (max)(abs(expected), Real(1));
Real mollified_relative_error = abs(expected - computed)/denom;
std::ios_base::fmtflags f( std::cerr.flags() );
std::cerr << std::setprecision(3);

View File

@@ -70,7 +70,7 @@ std::vector<T> generate_random_vector(size_t size, size_t seed)
else if constexpr (std::is_integral<T>::value)
{
// Rescaling by larger than 2 is UB!
std::uniform_int_distribution<T> dis(std::numeric_limits<T>::lowest()/2, std::numeric_limits<T>::max()/2);
std::uniform_int_distribution<T> dis(std::numeric_limits<T>::lowest()/2, (std::numeric_limits<T>::max)()/2);
for (size_t i = 0; i < v.size(); ++i)
{
v[i] = dis(gen);
@@ -136,7 +136,7 @@ void test_lp()
// Does it work with ublas vectors?
// Does it handle the overflow of intermediates?
boost::numeric::ublas::vector<Real> w(4);
Real bignum = sqrt(std::numeric_limits<Real>::max())/256;
Real bignum = sqrt((std::numeric_limits<Real>::max)())/256;
for (size_t i = 0; i < w.size(); ++i)
{
w[i] = bignum;
@@ -629,7 +629,7 @@ void test_l2_norm()
l2 = boost::math::tools::l2_norm(w);
BOOST_TEST(abs(l2 - 2) < tol);
Real bignum = 4*sqrt(std::numeric_limits<Real>::max());
Real bignum = 4*sqrt((std::numeric_limits<Real>::max)());
v[0] = bignum;
v[1] = 0;
v[2] = 0;

View File

@@ -1,3 +1,10 @@
// Copyright John Maddock 2019.
// 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)
#ifndef SC_
# define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
#endif

View File

@@ -72,10 +72,10 @@ using if_t = if_c<IfType::value, ThenType, ElseType>;
*/
template <typename T, std::size_t OrderValue>
struct test_constants_t {
static constexpr auto n_samples = if_t<mp11::mp_or<bmp::is_number<T>, bmp::is_number_expression<T>>, mp11::mp_int<10>, mp11::mp_int<25>>::value;
static constexpr auto n_samples = if_t<mp11::mp_or<bmp::is_number<T>, bmp::is_number_expression<T>>, mp11::mp_int<10>, mp11::mp_int<25>>::value;
static constexpr auto order = OrderValue;
static constexpr T pct_epsilon() BOOST_NOEXCEPT {
return (is_multiprecision_t<T>::value ? 2 : 1) * std::numeric_limits<T>::epsilon() * 100;
return (is_multiprecision_t<T>::value ? 2 : 1) * std::numeric_limits<T>::epsilon() * 100;
}
};
@@ -103,8 +103,8 @@ struct RandomSample {
"both be not integral");
using dist_t = if_t<is_integer_t,
std::uniform_int_distribution<distribution_param_t>,
std::uniform_real_distribution<distribution_param_t>>;
std::uniform_int_distribution<distribution_param_t>,
std::uniform_real_distribution<distribution_param_t>>;
struct get_integral_endpoint {
template <typename V>

View File

@@ -12,7 +12,8 @@
#include <boost/math/tools/recurrence.hpp>
#include <boost/math/special_functions/bessel.hpp>
#include <boost/test/included/unit_test.hpp>
#include <boost/test/tools/floating_point_comparison.hpp>
#include <boost/test/floating_point_comparison.hpp>
//#include <boost/test/tools/floating_point_comparison.hpp>
#include <boost/math/concepts/real_concept.hpp>
#ifdef BOOST_MSVC

View File

@@ -57,7 +57,7 @@ std::vector<T> generate_random_vector(size_t size, size_t seed)
else if constexpr (std::is_integral<T>::value)
{
// Rescaling by larger than 2 is UB!
std::uniform_int_distribution<T> dis(std::numeric_limits<T>::lowest()/2, std::numeric_limits<T>::max()/2);
std::uniform_int_distribution<T> dis(std::numeric_limits<T>::lowest()/2, (std::numeric_limits<T>::max)()/2);
for (size_t i = 0; i < v.size(); ++i)
{
v[i] = dis(gen);