1 // Copyright John Maddock 2006, 2007
2 // Copyright Paul A. Bristow 2007
4 // Use, modification and distribution are subject to the
5 // Boost Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #include <pch_light.hpp>
9 #include"test_hermite.hpp"
15 // This file tests the Hermite polynomials.
16 // There are two sets of tests, spot
17 // tests which compare our results with selected values computed
18 // using the online special function calculator at
19 // functions.wolfram.com, while the bulk of the accuracy tests
20 // use values generated with NTL::RR at 1000-bit precision
21 // and our generic versions of these functions.
23 // Note that when this file is first run on a new platform many of
24 // these tests will fail: the default accuracy is 1 epsilon which
25 // is too tight for most platforms. In this situation you will
26 // need to cast a human eye over the error rates reported and make
27 // a judgement as to whether they are acceptable. Either way please
28 // report the results to the Boost mailing list. Acceptable rates of
29 // error are marked up below as a series of regular expressions that
30 // identify the compiler/stdlib/platform/data-type/test-data/test-function
31 // along with the maximum expected peek and RMS mean errors for that
35 void expected_results()
38 // Define the max and mean errors expected for
39 // various compilers and platforms.
41 const char* largest_type;
42 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
43 if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >())
45 largest_type = "(long\\s+)?double";
49 largest_type = "long double";
52 largest_type = "(long\\s+)?double";
56 // Catch all cases come last:
62 largest_type, // test type(s)
63 ".*", // test data group
64 "boost::math::hermite", 10, 5); // test function
69 "real_concept", // test type(s)
70 ".*", // test data group
71 "boost::math::hermite", 10, 5); // test function
73 // Finish off by printing out the compiler/stdlib/platform names,
74 // we do this to make it easier to mark up expected error rates.
76 std::cout << "Tests run with " << BOOST_COMPILER << ", "
77 << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
80 BOOST_AUTO_TEST_CASE( test_main )
82 BOOST_MATH_CONTROL_FP;
84 boost::math::hermite(51, 915.0);
86 #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
87 test_spots(0.0F, "float");
89 test_spots(0.0, "double");
90 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
91 test_spots(0.0L, "long double");
92 test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
97 #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS
98 test_hermite(0.1F, "float");
100 test_hermite(0.1, "double");
101 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
102 test_hermite(0.1L, "long double");
103 #ifndef BOOST_MATH_NO_REAL_CONCEPT_TESTS
104 test_hermite(boost::math::concepts::real_concept(0.1), "real_concept");
107 std::cout << "<note>The long double tests have been disabled on this platform "
108 "either because the long double overloads of the usual math functions are "
109 "not available at all, or because they are too inaccurate for these tests "
110 "to pass.</note>" << std::cout;