]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/cohen_acceleration_test.cpp
2 * Copyright Nick Thompson, 2020
3 * Use, modification and distribution are subject to the
4 * Boost Software License, Version 1.0. (See accompanying file
5 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #include "math_unit_test.hpp"
9 #include <boost/math/tools/cohen_acceleration.hpp>
10 #include <boost/math/constants/constants.hpp>
11 #ifdef BOOST_HAS_FLOAT128
12 #include <boost/multiprecision/float128.hpp>
13 using boost::multiprecision::float128
;
15 #include <boost/multiprecision/cpp_bin_float.hpp>
18 using boost::math::tools::cohen_acceleration
;
19 using boost::multiprecision::cpp_bin_float_100
;
20 using boost::math::constants::pi
;
23 template<typename Real
>
39 template<typename Real
>
40 void test_pisq_div12()
43 Real x
= cohen_acceleration(g
);
44 CHECK_ULP_CLOSE(pi
<Real
>()*pi
<Real
>()/12, x
, 3);
47 template<typename Real
>
54 // See C3 of: https://people.mpim-bonn.mpg.de/zagier/files/exp-math-9/fulltext.pdf
65 template<typename Real
>
68 auto g
= Divergent
<Real
>();
69 Real x
= -cohen_acceleration(g
);
70 CHECK_ULP_CLOSE(log(pi
<Real
>()/2)/2, x
, 135);
75 test_pisq_div12
<float>();
76 test_pisq_div12
<double>();
77 test_pisq_div12
<long double>();
79 test_divergent
<float>();
80 test_divergent
<double>();
81 test_divergent
<long double>();
83 #ifdef BOOST_HAS_FLOAT128
84 test_pisq_div12
<float128
>();
85 test_divergent
<float128
>();
87 return boost::math::test::report_errors();