]>
git.proxmox.com Git - ceph.git/blob - 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
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)
9 #include <pch_light.hpp>
10 #include "test_ellint_2.hpp"
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.
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
36 void expected_results()
39 // Define the max and mean errors expected for
40 // various compilers and platforms.
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
<> >())
46 largest_type
= "(long\\s+)?double";
50 largest_type
= "long double";
53 largest_type
= "(long\\s+)?double";
56 if (std::numeric_limits
<long double>::digits
> 100)
62 "long double|real_concept", // test type(s)
63 ".*Mathworld.*", // test data group
64 ".*", 40, 10); // test function
67 // Catch all cases come last:
73 largest_type
, // test type(s)
74 ".*", // test data group
75 ".*", 15, 6); // test function
80 "real_concept", // test type(s)
81 ".*", // test data group
82 ".*", 15, 6); // test function
84 // Finish off by printing out the compiler/stdlib/platform names,
85 // we do this to make it easier to mark up expected error rates.
87 std::cout
<< "Tests run with " << BOOST_COMPILER
<< ", "
88 << BOOST_STDLIB
<< ", " << BOOST_PLATFORM
<< std::endl
;
92 BOOST_AUTO_TEST_CASE( test_main
)
95 BOOST_MATH_CONTROL_FP
;
96 #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
97 test_spots(0.0F
, "float");
99 test_spots(0.0, "double");
100 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
101 test_spots(0.0L, "long double");
102 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
103 test_spots(boost::math::concepts::real_concept(0), "real_concept");
106 std::cout
<< "<note>The long double tests have been disabled on this platform "
107 "either because the long double overloads of the usual math functions are "
108 "not available at all, or because they are too inaccurate for these tests "
109 "to pass.</note>" << std::endl
;