]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/test_bessel_j_prime.cpp
1 // Copyright (c) 2013 Anton Bikineev
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)
6 #include "pch_light.hpp"
8 #include "test_bessel_j_prime.hpp"
14 // This file tests the bessel functions derivatives. There are two sets of tests, spot
15 // tests which compare our results with selected values computed
16 // using the online special function calculator at
17 // functions.wolfram.com, while the bulk of the accuracy tests
18 // use values generated with Boost.Multiprecision at 50 precision
19 // and our generic versions of these functions.
21 // Note that when this file is first run on a new platform many of
22 // these tests will fail: the default accuracy is 1 epsilon which
23 // is too tight for most platforms. In this situation you will
24 // need to cast a human eye over the error rates reported and make
25 // a judgement as to whether they are acceptable. Either way please
26 // report the results to the Boost mailing list. Acceptable rates of
27 // error are marked up below as a series of regular expressions that
28 // identify the compiler/stdlib/platform/data-type/test-data/test-function
29 // along with the maximum expected peek and RMS mean errors for that
33 void expected_results()
36 // Define the max and mean errors expected for
37 // various compilers and platforms.
39 const char* largest_type
;
40 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
41 if(boost::math::policies::digits
<double, boost::math::policies::policy
<> >() == boost::math::policies::digits
<long double, boost::math::policies::policy
<> >())
43 largest_type
= "(long\\s+)?double|real_concept";
47 largest_type
= "long double|real_concept";
50 largest_type
= "(long\\s+)?double";
53 // HP-UX specific rates:
55 // Error rate for double precision are limited by the accuracy of
56 // the approximations use, which bracket rather than preserve the root.
62 largest_type
, // test type(s)
63 ".*J0'.*Tricky.*", // test data group
64 ".*", 80000000000LL, 80000000000LL); // test function
69 largest_type
, // test type(s)
70 ".*J1'.*Tricky.*", // test data group
71 ".*", 3000000, 2000000); // test function
76 "double", // test type(s)
77 ".*Tricky.*", // test data group
78 ".*", 100000, 100000); // test function
83 largest_type
, // test type(s)
84 ".*J'.*Tricky.*", // test data group
85 ".*", 3000, 500); // test function
90 ".*Tru64.*", // compiler
93 "double", // test type(s)
94 ".*Tricky.*", // test data group
95 ".*", 100000, 100000); // test function
97 ".*Tru64.*", // compiler
100 largest_type
, // test type(s)
101 ".*Tricky large.*", // test data group
102 ".*", 3000, 1000); // test function
104 // Solaris specific rates:
106 // Error rate for double precision are limited by the accuracy of
107 // the approximations use, which bracket rather than preserve the root.
112 "Sun Solaris", // platform
113 largest_type
, // test type(s)
114 "Bessel J': Random Data.*Tricky.*", // test data group
115 ".*", 3000, 500); // test function
119 "Sun Solaris", // platform
120 "double", // test type(s)
121 ".*Tricky.*", // test data group
122 ".*", 200000, 100000); // test function
126 "Sun Solaris", // platform
127 largest_type
, // test type(s)
128 ".*J'.*tricky.*", // test data group
129 ".*", 400000000, 200000000); // test function
136 "Mac OS", // platform
137 largest_type
, // test type(s)
138 ".*J0'.*Tricky.*", // test data group
139 ".*", 400000000, 400000000); // test function
143 "Mac OS", // platform
144 largest_type
, // test type(s)
145 ".*J1'.*Tricky.*", // test data group
146 ".*", 3000000, 2000000); // test function
150 "Mac OS", // platform
151 largest_type
, // test type(s)
152 "Bessel JN'.*", // test data group
153 ".*", 60000, 20000); // test function
157 "Mac OS", // platform
158 largest_type
, // test type(s)
159 "Bessel J':.*", // test data group
160 ".*", 60000, 20000); // test function
165 // Linux specific results:
167 // sin and cos appear to have only double precision for large
168 // arguments on some linux distros:
174 largest_type
, // test type(s)
175 ".*J':.*", // test data group
176 ".*", 60000, 30000); // test function
179 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
180 if((std::numeric_limits
<double>::digits
!= std::numeric_limits
<long double>::digits
)
181 && (std::numeric_limits
<long double>::digits
< 90))
183 // some errors spill over into type double as well:
188 "double", // test type(s)
189 ".*J0'.*Tricky.*", // test data group
190 ".*", 400000, 400000); // test function
195 "double", // test type(s)
196 ".*J1'.*Tricky.*", // test data group
197 ".*", 5000, 5000); // test function
202 "double", // test type(s)
203 ".*(JN'|j').*|.*Tricky.*", // test data group
204 ".*", 50, 50); // test function
209 "double", // test type(s)
210 ".*", // test data group
211 ".*", 30, 30); // test function
213 // and we have a few cases with higher limits as well:
219 largest_type
, // test type(s)
220 ".*J0'.*Tricky.*", // test data group
221 ".*", 400000000, 400000000); // test function
226 largest_type
, // test type(s)
227 ".*J1'.*Tricky.*", // test data group
228 ".*", 5000000, 5000000); // test function
233 largest_type
, // test type(s)
234 ".*(JN'|j').*|.*Tricky.*", // test data group
235 ".*", 60000, 40000); // test function
242 largest_type
, // test type(s)
243 ".*J0'.*Tricky.*", // test data group
244 ".*", 400000000, 400000000); // test function
249 largest_type
, // test type(s)
250 ".*J1'.*Tricky.*", // test data group
251 ".*", 5000000, 5000000); // test function
256 largest_type
, // test type(s)
257 "Bessel j':.*|Bessel JN': Mathworld.*|.*Tricky.*", // test data group
258 ".*", 1500, 700); // test function
263 largest_type
, // test type(s)
264 ".*", // test data group
265 ".*", 40, 20); // test function
267 // One set of float tests has inexact input values, so there is a slight error:
273 "float", // test type(s)
274 "Bessel J': Mathworld Data", // test data group
275 ".*", 30, 20); // test function
277 // Finish off by printing out the compiler/stdlib/platform names,
278 // we do this to make it easier to mark up expected error rates.
280 std::cout
<< "Tests run with " << BOOST_COMPILER
<< ", "
281 << BOOST_STDLIB
<< ", " << BOOST_PLATFORM
<< std::endl
;
284 BOOST_AUTO_TEST_CASE( test_main
)
287 gsl_set_error_handler_off();
290 BOOST_MATH_CONTROL_FP
;
292 test_bessel_prime(0.1F
, "float");
293 test_bessel_prime(0.1, "double");
294 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
295 test_bessel_prime(0.1L, "long double");
296 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
297 test_bessel_prime(boost::math::concepts::real_concept(0.1), "real_concept");
300 std::cout
<< "<note>The long double tests have been disabled on this platform "
301 "either because the long double overloads of the usual math functions are "
302 "not available at all, or because they are too inaccurate for these tests "
303 "to pass.</note>" << std::endl
;