]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | /////////////////////////////////////////////////////////////// |
2 | // Copyright Christopher Kormanyos 2021. | |
3 | // Copyright 2021 John Maddock. Distributed under the Boost | |
4 | // Software License, Version 1.0. (See accompanying file | |
5 | // LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt | |
6 | // | |
7 | ||
8 | #include <boost/detail/lightweight_test.hpp> | |
9 | #include <boost/math/special_functions/gamma.hpp> | |
10 | #include "test.hpp" | |
11 | ||
12 | #include <boost/multiprecision/cpp_dec_float.hpp> | |
13 | ||
14 | namespace local | |
15 | { | |
16 | template<typename T> constexpr T (max)(T a, T b) { return a > b ? a : b; } | |
17 | ||
18 | template<class T> | |
19 | void test() | |
20 | { | |
21 | // N[Gamma[5/2], 120] | |
22 | const T control_tgamma_2_and_half("1.32934038817913702047362561250585888709816209209179034616035584238968346344327413603121299255390849906217011771821192800"); | |
23 | ||
24 | // N[Gamma[500/2], 120] | |
25 | const T control_tgamma_2_fifty ("1.29314250436364309292832582080974738839793748706951226669917697084512949902204448379552716614841127978037140294127577317E490"); | |
26 | ||
27 | const T tgamma_2_and_half = boost::math::tgamma(T(T(5) / 2)); | |
28 | const T tgamma_2_fifty = boost::math::tgamma(T(T(500) / 2)); | |
29 | ||
30 | BOOST_CHECK_CLOSE_FRACTION(tgamma_2_and_half, control_tgamma_2_and_half, T(std::numeric_limits<T>::epsilon() * T(1.0E6))); | |
31 | BOOST_CHECK_CLOSE_FRACTION(tgamma_2_fifty , control_tgamma_2_fifty, T(std::numeric_limits<T>::epsilon() * T(1.0E6))); | |
32 | } | |
33 | } | |
34 | ||
35 | int main() | |
36 | { | |
37 | using big_float_type_016 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<(local::max)((int) (std::numeric_limits<double>::digits + 1), 16)>>; | |
38 | using big_float_type_035 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<(local::max)((int) (std::numeric_limits<double>::digits + 1), 35)>>; | |
39 | using big_float_type_105 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<105>>; | |
40 | ||
41 | local::test<big_float_type_016>(); | |
42 | local::test<big_float_type_035>(); | |
43 | local::test<big_float_type_105>(); | |
44 | ||
45 | return boost::report_errors(); | |
46 | } |