]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/test_igamma_inva.cpp
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 #include <pch_light.hpp>
7 #include "test_igamma_inva.hpp"
9 #if !defined(TEST_FLOAT) && !defined(TEST_DOUBLE) && !defined(TEST_LDOUBLE) && !defined(TEST_REAL_CONCEPT)
13 # define TEST_REAL_CONCEPT
20 // This file tests the incomplete gamma function inverses
21 // gamma_p_inva and gamma_q_inva. There are two sets of tests:
22 // 2) TODO: Accuracy tests use values generated with NTL::RR at
23 // 1000-bit precision and our generic versions of these functions.
24 // 3) Round trip sanity checks, use the test data for the forward
25 // functions, and verify that we can get (approximately) back
28 // Note that when this file is first run on a new platform many of
29 // these tests will fail: the default accuracy is 1 epsilon which
30 // is too tight for most platforms. In this situation you will
31 // need to cast a human eye over the error rates reported and make
32 // a judgement as to whether they are acceptable. Either way please
33 // report the results to the Boost mailing list. Acceptable rates of
34 // error are marked up below as a series of regular expressions that
35 // identify the compiler/stdlib/platform/data-type/test-data/test-function
36 // along with the maximum expected peek and RMS mean errors for that
40 void expected_results()
43 // Define the max and mean errors expected for
44 // various compilers and platforms.
46 const char* largest_type
;
47 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
48 if(boost::math::policies::digits
<double, boost::math::policies::policy
<> >() == boost::math::policies::digits
<long double, boost::math::policies::policy
<> >())
50 largest_type
= "(long\\s+)?double";
54 largest_type
= "long double";
57 largest_type
= "(long\\s+)?double";
66 largest_type
, // test type(s)
67 "[^|]*", // test data group
68 "[^|]*", 800, 200); // test function
71 // Catch all cases come last:
77 "real_concept", // test type(s)
78 "[^|]*", // test data group
79 "[^|]*", 3000, 1000); // test function
84 largest_type
, // test type(s)
85 "[^|]*", // test data group
86 "[^|]*", 300, 100); // test function
87 // this one has to come last in case double *is* the widest
93 "float|double", // test type(s)
94 "[^|]*", // test data group
95 "[^|]*", 10, 5); // test function
97 // Finish off by printing out the compiler/stdlib/platform names,
98 // we do this to make it easier to mark up expected error rates.
100 std::cout
<< "Tests run with " << BOOST_COMPILER
<< ", "
101 << BOOST_STDLIB
<< ", " << BOOST_PLATFORM
<< std::endl
;
104 BOOST_AUTO_TEST_CASE( test_main
)
107 BOOST_MATH_CONTROL_FP
;
109 #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
111 test_gamma(0.1F
, "float");
115 test_gamma(0.1, "double");
117 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
119 test_gamma(0.1L, "long double");
121 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
122 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
123 #ifdef TEST_REAL_CONCEPT
124 test_gamma(boost::math::concepts::real_concept(0.1), "real_concept");
129 std::cout
<< "<note>The long double tests have been disabled on this platform "
130 "either because the long double overloads of the usual math functions are "
131 "not available at all, or because they are too inaccurate for these tests "
132 "to pass.</note>" << std::endl
;