]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/test_laguerre.cpp
daf7ce021570db7f9a36653abe004cdcb79b38d8
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_laguerre.hpp"
13 // This file tests the Laguerre polynomials.
14 // There are two sets of tests, spot
15 // tests which compare our results with selected values computed
16 // using the online special function calculator at
17 // functions.wolfram.com, while the bulk of the accuracy tests
18 // use values generated with NTL::RR at 1000-bit precision
19 // and our generic versions of these functions.
21 // Note that when this file is first run on a new platform many of
22 // these tests will fail: the default accuracy is 1 epsilon which
23 // is too tight for most platforms. In this situation you will
24 // need to cast a human eye over the error rates reported and make
25 // a judgement as to whether they are acceptable. Either way please
26 // report the results to the Boost mailing list. Acceptable rates of
27 // error are marked up below as a series of regular expressions that
28 // identify the compiler/stdlib/platform/data-type/test-data/test-function
29 // along with the maximum expected peek and RMS mean errors for that
33 void expected_results()
36 // Define the max and mean errors expected for
37 // various compilers and platforms.
39 const char* largest_type
;
40 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
41 if(boost::math::policies::digits
<double, boost::math::policies::policy
<> >() == boost::math::policies::digits
<long double, boost::math::policies::policy
<> >())
43 largest_type
= "(long\\s+)?double";
47 largest_type
= "long double";
50 largest_type
= "(long\\s+)?double";
53 // Linux special cases, error rates seem to be much higer here
54 // even though the implementation contains nothing but basic
57 if((std::numeric_limits
<long double>::digits
<= 64)
58 && (std::numeric_limits
<long double>::digits
!= std::numeric_limits
<double>::digits
))
60 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
65 "double", // test type(s)
66 ".*", // test data group
67 ".*", 10, 5); // test function
73 "linux.*|Mac OS|Sun.*", // platform
74 largest_type
, // test type(s)
75 ".*", // test data group
76 ".*", 40000, 1000); // test function
80 "linux.*|Mac OS|Sun.*", // platform
81 "real_concept", // test type(s)
82 ".*", // test data group
83 ".*", 40000, 1000); // test function
87 "Win32.*", // platform
88 largest_type
, // test type(s)
89 ".*", // test data group
90 ".*", 40000, 1000); // test function
94 "Win32.*", // platform
95 "real_concept", // test type(s)
96 ".*", // test data group
97 ".*", 40000, 1000); // test function
101 "IBM Aix", // platform
102 largest_type
, // test type(s)
103 ".*", // test data group
104 ".*", 5000, 500); // test function
108 "IBM Aix", // platform
109 "real_concept", // test type(s)
110 ".*", // test data group
111 ".*", 5000, 500); // test function
114 // Catch all cases come last:
120 largest_type
, // test type(s)
121 ".*", // test data group
122 ".*", 4000, 500); // test function
127 "real_concept", // test type(s)
128 ".*", // test data group
129 ".*", 4000, 500); // 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
)
141 BOOST_MATH_CONTROL_FP
;
143 #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
144 test_spots(0.0F
, "float");
146 test_spots(0.0, "double");
147 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
148 test_spots(0.0L, "long double");
149 test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
154 #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
155 test_laguerre(0.1F
, "float");
157 test_laguerre(0.1, "double");
158 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
159 test_laguerre(0.1L, "long double");
160 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
161 test_laguerre(boost::math::concepts::real_concept(0.1), "real_concept");
164 std::cout
<< "<note>The long double tests have been disabled on this platform "
165 "either because the long double overloads of the usual math functions are "
166 "not available at all, or because they are too inaccurate for these tests "
167 "to pass.</note>" << std::endl
;