2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Merge branch 'predef' into config

This commit is contained in:
Matt Borland
2021-03-26 19:40:18 +03:00
11 changed files with 96 additions and 7 deletions

View File

@@ -21,6 +21,7 @@
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/special_functions/log1p.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
// This is the inverse of the hyperbolic cosine function.

View File

@@ -22,6 +22,7 @@
#include <boost/math/special_functions/sqrt1pm1.hpp>
#include <boost/math/special_functions/log1p.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
// This is the inverse of the hyperbolic sine function.

View File

@@ -20,6 +20,7 @@
#include <boost/math/policies/error_handling.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/special_functions/log1p.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
// This is the inverse of the hyperbolic tangent function.

View File

@@ -42,9 +42,17 @@ With these techniques, the code could be simplified.
#else // Does not have compliant C++20
#ifdef _WIN32
#define BOOST_MATH_ENDIAN_BIG_BYTE 1
#define BOOST_MATH_ENDIAN_LITTLE_BYTE 0
#else
#define BOOST_MATH_ENDIAN_BIG_BYTE (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#define BOOST_MATH_ENDIAN_LITTLE_BYTE (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#endif // Windows or POSIX
#endif // Standalone mode
#endif // Endian

View File

@@ -22,6 +22,7 @@
#include <boost/math/policies/error_handling.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/tools/assert.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128)
//

View File

@@ -17,18 +17,24 @@ namespace boost {
namespace math {
namespace tools {
namespace detail {
template <typename T, typename = void>
struct is_complex_type
struct is_complex_type_impl
{
static constexpr bool value = false;
};
template <typename T>
struct is_complex_type<T, void_t<decltype(std::declval<T>().real()),
decltype(std::declval<T>().imag())>>
struct is_complex_type_impl<T, void_t<decltype(std::declval<T>().real()),
decltype(std::declval<T>().imag())>>
{
static constexpr bool value = true;
};
} // Namespace detail
template <typename T>
struct is_complex_type : public detail::is_complex_type_impl<T> {};
//
// Use this trait to typecast integer literals to something
// that will interoperate with T:

View File

@@ -944,6 +944,9 @@ test-suite misc :
[ run compile_test/compl_asinh_incl_test.cpp compile_test_main ]
[ run compile_test/compl_atan_incl_test.cpp compile_test_main ]
[ run compile_test/compl_atanh_incl_test.cpp compile_test_main ]
[ run compile_test/sf_acosh_incl_test.cpp compile_test_main ]
[ run compile_test/sf_asinh_incl_test.cpp compile_test_main ]
[ run compile_test/sf_atanh_incl_test.cpp compile_test_main ]
[ run compile_test/sf_beta_incl_test.cpp compile_test_main ]
[ run compile_test/sf_bernoulli_incl_test.cpp compile_test_main ]
[ run compile_test/sf_bessel_incl_test.cpp compile_test_main ]

View File

@@ -0,0 +1,23 @@
// Copyright John Maddock 2006.
// 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)
//
// Basic sanity check that header <boost/math/special_functions/acosh.hpp>
// #includes all the files that it needs to.
//
#include <boost/math/special_functions/acosh.hpp>
//
// Note this header includes no other headers, this is
// important if this test is to be meaningful:
//
#include "test_compile_result.hpp"
void compile_and_link_test()
{
check_result<float>(boost::math::acosh<float>(f));
check_result<double>(boost::math::acosh<double>(d));
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
check_result<long double>(boost::math::acosh<long double>(l));
#endif
}

View File

@@ -0,0 +1,23 @@
// Copyright John Maddock 2006.
// 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)
//
// Basic sanity check that header <boost/math/special_functions/asinh.hpp>
// #includes all the files that it needs to.
//
#include <boost/math/special_functions/asinh.hpp>
//
// Note this header includes no other headers, this is
// important if this test is to be meaningful:
//
#include "test_compile_result.hpp"
void compile_and_link_test()
{
check_result<float>(boost::math::asinh<float>(f));
check_result<double>(boost::math::asinh<double>(d));
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
check_result<long double>(boost::math::asinh<long double>(l));
#endif
}

View File

@@ -0,0 +1,23 @@
// Copyright John Maddock 2006.
// 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)
//
// Basic sanity check that header <boost/math/special_functions/log1p.hpp>
// #includes all the files that it needs to.
//
#include <boost/math/special_functions/atanh.hpp>
//
// Note this header includes no other headers, this is
// important if this test is to be meaningful:
//
#include "test_compile_result.hpp"
void compile_and_link_test()
{
check_result<float>(boost::math::atanh<float>(f));
check_result<double>(boost::math::atanh<double>(d));
#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
check_result<long double>(boost::math::atanh<long double>(l));
#endif
}

View File

@@ -620,7 +620,7 @@ void test_median_absolute_deviation(ExecutionPolicy&& exec)
template<class Real, class ExecutionPolicy>
void test_sample_gini_coefficient(ExecutionPolicy&& exec)
{
Real tol = std::numeric_limits<Real>::epsilon();
Real tol = 10*std::numeric_limits<Real>::epsilon();
std::vector<Real> v{1,0,0};
Real gini = boost::math::statistics::sample_gini_coefficient(exec, v.begin(), v.end());
BOOST_TEST(abs(gini - 1) < tol);
@@ -649,7 +649,7 @@ void test_sample_gini_coefficient(ExecutionPolicy&& exec)
template<class Real, class ExecutionPolicy>
void test_gini_coefficient(ExecutionPolicy&& exec)
{
Real tol = std::numeric_limits<Real>::epsilon();
Real tol = 10*std::numeric_limits<Real>::epsilon();
std::vector<Real> v{1,0,0};
Real gini = boost::math::statistics::gini_coefficient(exec, v.begin(), v.end());
Real expected = Real(2)/Real(3);
@@ -691,8 +691,7 @@ void test_gini_coefficient(ExecutionPolicy&& exec)
v[i] = dis(gen);
}
gini = boost::math::statistics::gini_coefficient(exec, v);
BOOST_TEST(abs(gini - expected) < 0.02);
BOOST_TEST(abs(gini - expected) < Real(0.03));
}
template<class Z, class ExecutionPolicy>