]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/test_ibeta_derivative.cpp
27184ff5e432ef2bb63d46298aad14cf2dcc0687
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)
6 #pragma GCC diagnostic push
7 #pragma GCC diagnostic ignored "-Wliteral-range"
9 #include <pch_light.hpp>
10 #include "test_ibeta_derivative.hpp"
12 #if !defined(TEST_FLOAT) && !defined(TEST_DOUBLE) && !defined(TEST_LDOUBLE) && !defined(TEST_REAL_CONCEPT)
16 # define TEST_REAL_CONCEPT
23 // This file tests the incomplete beta functions beta,
24 // betac, ibeta and ibetac. There are two sets of tests, spot
25 // tests which compare our results with selected values computed
26 // using the online special function calculator at
27 // functions.wolfram.com, while the bulk of the accuracy tests
28 // use values generated with NTL::RR at 1000-bit precision
29 // and our generic versions of these functions.
31 // Note that when this file is first run on a new platform many of
32 // these tests will fail: the default accuracy is 1 epsilon which
33 // is too tight for most platforms. In this situation you will
34 // need to cast a human eye over the error rates reported and make
35 // a judgement as to whether they are acceptable. Either way please
36 // report the results to the Boost mailing list. Acceptable rates of
37 // error are marked up below as a series of regular expressions that
38 // identify the compiler/stdlib/platform/data-type/test-data/test-function
39 // along with the maximum expected peek and RMS mean errors for that
43 void expected_results()
46 // Define the max and mean errors expected for
47 // various compilers and platforms.
49 const char* largest_type
;
50 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
51 if(boost::math::policies::digits
<double, boost::math::policies::policy
<> >() == boost::math::policies::digits
<long double, boost::math::policies::policy
<> >())
53 largest_type
= "(long\\s+)?double|real_concept";
57 largest_type
= "long double|real_concept";
60 largest_type
= "(long\\s+)?double";
63 if(std::numeric_limits
<long double>::max_exponent
> std::numeric_limits
<double>::max_exponent
)
69 largest_type
, // test type(s)
70 "[^|]*Medium.*", // test data group
71 ".*", 200000, 7000); // test function
76 "real_concept", // test type(s)
77 "[^|]*Large.*", // test data group
78 ".*", 300000, 10000); // test function
83 largest_type
, // test type(s)
84 "[^|]*Large.*", // test data group
85 ".*", 80000, 5000); // test function
90 largest_type
, // test type(s)
91 "[^|]*Integer.*", // test data group
92 ".*", 30000, 1500); // test function
97 "double", // test type(s)
98 "[^|]*Large.*", // test data group
99 ".*", 3300, 200); // test function
104 "double", // test type(s)
105 "[^|]*", // test data group
106 ".*", 200, 50); // test function
109 // catch all default is 2eps for all types:
114 "real_concept", // test type(s)
115 "[^|]*large.*", // test data group
116 ".*", 200000, 6000); // test function
121 largest_type
, // test type(s)
122 "[^|]*large.*", // test data group
123 ".*", 3300, 200); // test function
128 largest_type
, // test type(s)
129 "[^|]*", // test data group
130 ".*", 300, 100); // test function
132 // Finish off by printing out the compiler/stdlib/platform names,
133 // we do this to make it easier to mark up expected error rates.
135 std::cout
<< "Tests run with " << BOOST_COMPILER
<< ", "
136 << BOOST_STDLIB
<< ", " << BOOST_PLATFORM
<< std::endl
;
139 BOOST_AUTO_TEST_CASE( test_main
)
142 BOOST_MATH_CONTROL_FP
;
144 gsl_set_error_handler_off();
152 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
156 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
157 #ifdef TEST_REAL_CONCEPT
158 test_spots(boost::math::concepts::real_concept(0.1));
164 test_beta(0.1F
, "float");
167 test_beta(0.1, "double");
169 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
171 test_beta(0.1L, "long double");
173 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
174 #ifdef TEST_REAL_CONCEPT
175 test_beta(boost::math::concepts::real_concept(0.1), "real_concept");
179 std::cout
<< "<note>The long double tests have been disabled on this platform "
180 "either because the long double overloads of the usual math functions are "
181 "not available at all, or because they are too inaccurate for these tests "
182 "to pass.</note>" << std::endl
;
186 #if defined(__GNUC__)
187 #pragma GCC diagnostic pop