]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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) | |
5 | ||
6 | #include "pch_light.hpp" | |
7 | #include "test_zeta.hpp" | |
8 | ||
9 | // | |
10 | // DESCRIPTION: | |
11 | // ~~~~~~~~~~~~ | |
12 | // | |
13 | // This file tests the zeta function. There are two sets of tests: | |
14 | // 1) Sanity checks: comparison to test values created with the | |
15 | // online calculator at functions.wolfram.com | |
16 | // 2) Accuracy tests use values generated with NTL::RR at | |
17 | // 1000-bit precision and our generic versions of these functions. | |
18 | // | |
19 | // Note that when this file is first run on a new platform many of | |
20 | // these tests will fail: the default accuracy is 1 epsilon which | |
21 | // is too tight for most platforms. In this situation you will | |
22 | // need to cast a human eye over the error rates reported and make | |
23 | // a judgement as to whether they are acceptable. Either way please | |
24 | // report the results to the Boost mailing list. Acceptable rates of | |
25 | // error are marked up below as a series of regular expressions that | |
26 | // identify the compiler/stdlib/platform/data-type/test-data/test-function | |
27 | // along with the maximum expected peek and RMS mean errors for that | |
28 | // test. | |
29 | // | |
30 | ||
31 | void expected_results() | |
32 | { | |
33 | // | |
34 | // Define the max and mean errors expected for | |
35 | // various compilers and platforms. | |
36 | // | |
37 | const char* largest_type; | |
38 | #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS | |
39 | if(boost::math::policies::digits<double, boost::math::policies::policy<> >() == boost::math::policies::digits<long double, boost::math::policies::policy<> >()) | |
40 | { | |
41 | largest_type = "(long\\s+)?double"; | |
42 | } | |
43 | else | |
44 | { | |
45 | largest_type = "long double"; | |
46 | } | |
47 | #else | |
48 | largest_type = "(long\\s+)?double"; | |
49 | #endif | |
50 | ||
51 | add_expected_result( | |
52 | ".*", // compiler | |
53 | ".*", // stdlib | |
54 | ".*", // platform | |
55 | largest_type, // test type(s) | |
56 | ".*Random values less than 1", // test data group | |
57 | ".*", 1200, 500); // test function | |
58 | add_expected_result( | |
59 | ".*", // compiler | |
60 | ".*", // stdlib | |
61 | ".*", // platform | |
62 | "real_concept", // test type(s) | |
63 | ".*Random values less than 1", // test data group | |
64 | ".*", 1200, 500); // test function | |
65 | add_expected_result( | |
66 | ".*", // compiler | |
67 | ".*", // stdlib | |
68 | ".*", // platform | |
69 | largest_type, // test type(s) | |
70 | ".*Integer.*", // test data group | |
71 | ".*", 30, 15); // test function | |
72 | add_expected_result( | |
73 | ".*", // compiler | |
74 | ".*", // stdlib | |
75 | ".*", // platform | |
76 | largest_type, // test type(s) | |
77 | ".*", // test data group | |
78 | ".*", 3, 3); // test function | |
79 | add_expected_result( | |
80 | ".*", // compiler | |
81 | ".*", // stdlib | |
82 | ".*Solaris.*", // platform | |
83 | "real_concept", // test type(s) | |
84 | ".*", // test data group | |
85 | ".*", 60, 15); // test function | |
86 | add_expected_result( | |
87 | ".*", // compiler | |
88 | ".*", // stdlib | |
89 | ".*", // platform | |
90 | "real_concept", // test type(s) | |
91 | ".*", // test data group | |
92 | ".*", 40, 15); // test function | |
93 | ||
94 | std::cout << "Tests run with " << BOOST_COMPILER << ", " | |
95 | << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; | |
96 | } | |
97 | ||
98 | BOOST_AUTO_TEST_CASE( test_main ) | |
99 | { | |
100 | expected_results(); | |
101 | BOOST_MATH_CONTROL_FP; | |
102 | ||
103 | test_spots(0.0f, "float"); | |
104 | test_spots(0.0, "double"); | |
105 | #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS | |
106 | test_spots(0.0L, "long double"); | |
107 | test_spots(boost::math::concepts::real_concept(0.1), "real_concept"); | |
108 | #else | |
109 | std::cout << "<note>The long double tests have been disabled on this platform " | |
110 | "either because the long double overloads of the usual math functions are " | |
111 | "not available at all, or because they are too inaccurate for these tests " | |
112 | "to pass.</note>" << std::endl; | |
113 | #endif | |
114 | ||
115 | test_zeta(0.1F, "float"); | |
116 | test_zeta(0.1, "double"); | |
117 | #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS | |
118 | test_zeta(0.1L, "long double"); | |
119 | test_zeta(boost::math::concepts::real_concept(0.1), "real_concept"); | |
120 | #else | |
121 | std::cout << "<note>The long double tests have been disabled on this platform " | |
122 | "either because the long double overloads of the usual math functions are " | |
123 | "not available at all, or because they are too inaccurate for these tests " | |
124 | "to pass.</note>" << std::endl; | |
125 | #endif | |
126 | ||
127 | } | |
128 | ||
129 | ||
130 |