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