]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/test_ellint_2.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / math / test / test_ellint_2.cpp
1 // Copyright Xiaogang Zhang 2006
2 // Copyright John Maddock 2006, 2007
3 // Copyright Paul A. Bristow 2007
4
5 // Use, modification and distribution are subject to the
6 // Boost Software License, Version 1.0. (See accompanying file
7 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8
9 #include <pch_light.hpp>
10 #include "test_ellint_2.hpp"
11
12 //
13 // DESCRIPTION:
14 // ~~~~~~~~~~~~
15 //
16 // This file tests the Elliptic Integrals of the second kind.
17 // There are two sets of tests, spot
18 // tests which compare our results with selected values computed
19 // using the online special function calculator at
20 // functions.wolfram.com, while the bulk of the accuracy tests
21 // use values generated with NTL::RR at 1000-bit precision
22 // and our generic versions of these functions.
23 //
24 // Note that when this file is first run on a new platform many of
25 // these tests will fail: the default accuracy is 1 epsilon which
26 // is too tight for most platforms. In this situation you will
27 // need to cast a human eye over the error rates reported and make
28 // a judgement as to whether they are acceptable. Either way please
29 // report the results to the Boost mailing list. Acceptable rates of
30 // error are marked up below as a series of regular expressions that
31 // identify the compiler/stdlib/platform/data-type/test-data/test-function
32 // along with the maximum expected peek and RMS mean errors for that
33 // test.
34 //
35
36 void expected_results()
37 {
38 //
39 // Define the max and mean errors expected for
40 // various compilers and platforms.
41 //
42 const char* largest_type;
43 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
44 if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
45 {
46 largest_type = "(long\\s+)?double";
47 }
48 else
49 {
50 largest_type = "long double";
51 }
52 #else
53 largest_type = "(long\\s+)?double";
54 #endif
55
56 //
57 // Catch all cases come last:
58 //
59 add_expected_result(
60 ".*", // compiler
61 ".*", // stdlib
62 ".*", // platform
63 largest_type, // test type(s)
64 ".*", // test data group
65 ".*", 15, 6); // test function
66 add_expected_result(
67 ".*", // compiler
68 ".*", // stdlib
69 ".*", // platform
70 "real_concept", // test type(s)
71 ".*", // test data group
72 ".*", 15, 6); // test function
73 //
74 // Finish off by printing out the compiler/stdlib/platform names,
75 // we do this to make it easier to mark up expected error rates.
76 //
77 std::cout << "Tests run with " << BOOST_COMPILER << ", "
78 << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
79 }
80
81
82 BOOST_AUTO_TEST_CASE( test_main )
83 {
84 expected_results();
85 BOOST_MATH_CONTROL_FP;
86 #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
87 test_spots(0.0F, "float");
88 #endif
89 test_spots(0.0, "double");
90 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
91 test_spots(0.0L, "long double");
92 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
93 test_spots(boost::math::concepts::real_concept(0), "real_concept");
94 #endif
95 #else
96 std::cout << "<note>The long double tests have been disabled on this platform "
97 "either because the long double overloads of the usual math functions are "
98 "not available at all, or because they are too inaccurate for these tests "
99 "to pass.</note>" << std::endl;
100 #endif
101
102 }