]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/test_beta.cpp
1 // Copyright John Maddock 2006.
2 // Copyright Paul A. Bristow 2007, 2009
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)
8 #include "pch_light.hpp"
10 #include "test_beta.hpp"
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.
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
35 void expected_results()
38 // Define the max and mean errors expected for
39 // various compilers and platforms.
41 #if LDBL_MANT_DIG == 106
46 "Mac OS.*", // platform
47 "(long\\s+)?double", // test type(s)
48 "Beta Function: Medium.*", // test data group
49 "beta", 200, 35); // test function
56 "(long\\s+)?double", // test type(s)
57 "Beta Function: Small.*", // test data group
58 "beta", 8, 5); // test function
63 "(long\\s+)?double", // test type(s)
64 "Beta Function: Medium.*", // test data group
65 "beta", 160, 35); // test function
70 "(long\\s+)?double", // test type(s)
71 "Beta Function: Divergent.*", // test data group
72 "beta", 30, 6); // test function
77 "real_concept", // test type(s)
78 "Beta Function: Small.*", // test data group
79 "beta", 15, 15); // test function
84 "real_concept", // test type(s)
85 "Beta Function: Medium.*", // test data group
86 "beta", 150, 40); // test function
91 "real_concept", // test type(s)
92 "Beta Function: Divergent.*", // test data group
93 "beta", 25, 8); // test function
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.
99 std::cout
<< "Tests run with " << BOOST_COMPILER
<< ", "
100 << BOOST_STDLIB
<< ", " << BOOST_PLATFORM
<< std::endl
;
103 BOOST_AUTO_TEST_CASE( test_main
)
106 BOOST_MATH_CONTROL_FP
;
109 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
111 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
112 test_spots(boost::math::concepts::real_concept(0.1));
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
;
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");
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
;