]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/test_jacobi.cpp
1 // Copyright John Maddock 2012
3 // Use, modification and distribution are subject to the
4 // Boost Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #include <pch_light.hpp>
8 #include <test_jacobi.hpp>
14 // This file tests the Jacobi Elliptic Functions.
15 // There are two sets of tests, spot
16 // tests which compare our results with selected values computed
17 // using the online special function calculator at
18 // functions.wolfram.com, while the bulk of the accuracy tests
19 // use values generated with NTL::RR at 1000-bit precision
20 // and our generic versions of these functions.
22 // Note that when this file is first run on a new platform many of
23 // these tests will fail: the default accuracy is 1 epsilon which
24 // is too tight for most platforms. In this situation you will
25 // need to cast a human eye over the error rates reported and make
26 // a judgement as to whether they are acceptable. Either way please
27 // report the results to the Boost mailing list. Acceptable rates of
28 // error are marked up below as a series of regular expressions that
29 // identify the compiler/stdlib/platform/data-type/test-data/test-function
30 // along with the maximum expected peek and RMS mean errors for that
34 void expected_results()
37 // Define the max and mean errors expected for
38 // various compilers and platforms.
40 const char* largest_type
;
41 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
42 if(boost::math::policies::digits
<double, boost::math::policies::policy
<> >() == boost::math::policies::digits
<long double, boost::math::policies::policy
<> >())
44 largest_type
= "(long\\s+)?double|real_concept";
48 largest_type
= "long double|real_concept";
51 largest_type
= "(long\\s+)?double";
58 largest_type
, // test type(s)
59 ".*Mathworld.*", // test data group
60 ".*", 500, 250); // test function
65 largest_type
, // test type(s)
66 ".*Large Phi.*", // test data group
67 ".*", 50000, 5000); // test function
72 largest_type
, // test type(s)
73 ".*near 1.*", // test data group
74 ".*", 7000, 500); // test function
76 if(std::numeric_limits
<long double>::digits
== 64)
79 // Some errors spill over into double precision:
85 "double", // test type(s)
86 ".*Large Phi.*", // test data group
87 ".*", 500, 50); // test function
92 "double", // test type(s)
93 ".*near 1.*", // test data group
94 ".*", 10, 5); // test function
97 // Catch all cases come last:
103 largest_type
, // test type(s)
104 ".*", // test data group
105 ".*", 50, 20); // test function
107 // Finish off by printing out the compiler/stdlib/platform names,
108 // we do this to make it easier to mark up expected error rates.
110 std::cout
<< "Tests run with " << BOOST_COMPILER
<< ", "
111 << BOOST_STDLIB
<< ", " << BOOST_PLATFORM
<< std::endl
;
115 BOOST_AUTO_TEST_CASE( test_main
)
118 BOOST_MATH_CONTROL_FP
;
120 test_spots(0.0F
, "float");
121 test_spots(0.0, "double");
122 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
123 test_spots(0.0L, "long double");
124 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
125 test_spots(boost::math::concepts::real_concept(0), "real_concept");
128 std::cout
<< "<note>The long double tests have been disabled on this platform "
129 "either because the long double overloads of the usual math functions are "
130 "not available at all, or because they are too inaccurate for these tests "
131 "to pass.</note>" << std::endl
;