]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/test/test_1F1.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / test / test_1F1.cpp
CommitLineData
92f5a8d4
TL
1// (C) Copyright John Maddock 2006.
2// Use, modification and distribution are subject to the
3// Boost Software License, Version 1.0. (See accompanying file
4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#include "test_1F1.hpp"
7
8#include <boost/multiprecision/cpp_bin_float.hpp>
9
10void expected_results()
11{
12 //
13 // Define the max and mean errors expected for
14 // various compilers and platforms.
15 //
16 const char* largest_type;
17#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
18 if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
19 {
20 largest_type = "(long\\s+)?double|real_concept|cpp_bin_float_quad|dec_40|cpp_bin_float_double_extended";
21 }
22 else
23 {
24 largest_type = "long double|real_concept|cpp_bin_float_quad|dec_40|cpp_bin_float_double_extended";
25 }
26#else
27 largest_type = "(long\\s+)?double";
28#endif
29
30 add_expected_result(
31 ".*", // compiler
32 ".*", // stdlib
33 ".*", // platform
34 "cpp_bin_float_quad|cpp_bin_float_double_extended", // test type(s)
35 "Integer a values", // test data group
36 ".*", 25000, 800); // test function
37 add_expected_result(
38 ".*", // compiler
39 ".*", // stdlib
40 ".*", // platform
41 "cpp_bin_float_quad|cpp_bin_float_double_extended", // test type(s)
42 "Large.*", // test data group
43 ".*", 500000, 22000); // test function
44 add_expected_result(
45 ".*", // compiler
46 ".*", // stdlib
47 ".*", // platform
48 "cpp_bin_float_quad|cpp_bin_float_double_extended", // test type(s)
49 "Small.*", // test data group
50 ".*", 2000, 200); // test function
51
52 add_expected_result(
53 ".*", // compiler
54 ".*", // stdlib
55 ".*", // platform
56 "dec_40", // test type(s)
57 "Integer a values", // test data group
58 ".*", 12000, 800); // test function
59 add_expected_result(
60 ".*", // compiler
61 ".*", // stdlib
62 ".*", // platform
63 "dec_40", // test type(s)
64 "Large.*", // test data group
65 ".*", 20000000L, 650000L); // test function
66 add_expected_result(
67 ".*", // compiler
68 ".*", // stdlib
69 ".*", // platform
70 "dec_40", // test type(s)
71 "Small.*", // test data group
72 ".*", 1000, 300); // test function
73
74#if (LDBL_MANT_DIG < DBL_MANT_DIG * 2) && (LDBL_MANT_DIG != DBL_MANT_DIG)
75 //
76 // long double has only a little extra precision and errors may creep
77 // into the double results:
78 //
79 add_expected_result(
80 ".*", // compiler
81 ".*", // stdlib
82 ".*", // platform
83 "double", // test type(s)
84 "Integer a values", // test data group
85 ".*", 5, 3); // test function
86
87 add_expected_result(
88 ".*", // compiler
89 ".*", // stdlib
90 ".*", // platform
91 "double", // test type(s)
92 "Small.*", // test data group
93 ".*", 5, 3); // test function
94
95 add_expected_result(
96 ".*", // compiler
97 ".*", // stdlib
98 ".*", // platform
99 "double", // test type(s)
100 "Large.*", // test data group
101 ".*", 40, 20); // test function
102 add_expected_result(
103 ".*", // compiler
104 ".*", // stdlib
105 ".*", // platform
106 "double", // test type(s)
107 "Bug.*", // test data group
108 ".*", 300, 50); // test function
1e59de90
TL
109#elif(LDBL_MANT_DIG != DBL_MANT_DIG)
110 add_expected_result(
111 ".*", // compiler
112 ".*", // stdlib
113 ".*", // platform
114 "double", // test type(s)
115 ".*double limited precision.*", // test data group
116 ".*", 10, 5); // test function
92f5a8d4
TL
117
118#endif
119
120 add_expected_result(
121 ".*", // compiler
122 ".*", // stdlib
123 ".*", // platform
124 largest_type, // test type(s)
125 "Integer a values", // test data group
126 ".*", 16000, 600); // test function
127
128 add_expected_result(
129 ".*", // compiler
130 ".*", // stdlib
131 ".*", // platform
132 largest_type, // test type(s)
133 "Small.*", // test data group
134 ".*", 2000, 200); // test function
135
136 add_expected_result(
137 ".*", // compiler
138 ".*", // stdlib
139 ".*", // platform
140 largest_type, // test type(s)
141 "Large.*", // test data group
142 ".*", 400000, 9000); // test function
143 add_expected_result(
144 ".*", // compiler
145 ".*", // stdlib
146 ".*", // platform
147 "dec_40", // test type(s)
148 "Bug cases.*", // test data group
149 ".*", 2200000, 430000); // test function
150 add_expected_result(
151 ".*", // compiler
152 ".*", // stdlib
153 ".*", // platform
154 largest_type, // test type(s)
155 "Bug cases.*", // test data group
156 ".*", 1500000, 430000); // test function
157
158 //
159 // Finish off by printing out the compiler/stdlib/platform names,
160 // we do this to make it easier to mark up expected error rates.
161 //
162 std::cout << "Tests run with " << BOOST_COMPILER << ", "
163 << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
164}
165
166BOOST_AUTO_TEST_CASE( test_main )
167{
168 expected_results();
169 BOOST_MATH_CONTROL_FP;
170
171#if !defined(TEST) || (TEST == 1)
172 test_hypergeometric_mellin_transform<double>();
173 test_hypergeometric_laplace_transform<double>();
174#endif
175
176#ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
177#if !defined(TEST) || (TEST == 2)
178 test_spots(0.0F, "float");
179#endif
180#endif
181#if !defined(TEST) || (TEST == 3)
182 test_spots(0.0, "double");
183#endif
184#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
185#if (!defined(TEST) || (TEST == 4)) && (DBL_MAX_EXP != LDBL_MAX_EXP)
186 test_spots(0.0L, "long double");
187#endif
188#ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
189#if !defined(TEST) || (TEST == 5)
190 test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
191#endif
192#endif
193#endif
1e59de90
TL
194 //
195 // These next 2 tests take effectively "forever" to compile with clang:
196 //
197#if (!defined(TEST) || (TEST == 6)) && !defined(__clang__)
92f5a8d4
TL
198 test_spots(boost::multiprecision::cpp_bin_float_quad(), "cpp_bin_float_quad");
199#endif
1e59de90 200#if (!defined(TEST) || (TEST == 7)) && !defined(__clang__)
92f5a8d4
TL
201 typedef boost::multiprecision::number<boost::multiprecision::cpp_bin_float<40> > dec_40;
202 test_spots(dec_40(), "dec_40");
203#endif
204}
205