]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/test/test_zeta.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / math / test / test_zeta.cpp
CommitLineData
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"
b32b8144
FG
7#ifndef BOOST_MATH_OVERFLOW_ERROR_POLICY
8# define BOOST_MATH_OVERFLOW_ERROR_POLICY ignore_error
9#endif
7c673cae
FG
10#include "test_zeta.hpp"
11
12//
13// DESCRIPTION:
14// ~~~~~~~~~~~~
15//
16// This file tests the zeta function. There are two sets of tests:
17// 1) Sanity checks: comparison to test values created with the
18// online calculator at functions.wolfram.com
19// 2) Accuracy tests use values generated with NTL::RR at
20// 1000-bit precision and our generic versions of these functions.
21//
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
31// test.
32//
33
34void expected_results()
35{
36 //
37 // Define the max and mean errors expected for
38 // various compilers and platforms.
39 //
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<> >())
43 {
44 largest_type = "(long\\s+)?double";
45 }
46 else
47 {
48 largest_type = "long double";
49 }
50#else
51 largest_type = "(long\\s+)?double";
52#endif
53
54 add_expected_result(
55 ".*", // compiler
56 ".*", // stdlib
57 ".*", // platform
58 largest_type, // test type(s)
59 ".*Random values less than 1", // test data group
60 ".*", 1200, 500); // test function
61 add_expected_result(
62 ".*", // compiler
63 ".*", // stdlib
64 ".*", // platform
65 "real_concept", // test type(s)
66 ".*Random values less than 1", // test data group
67 ".*", 1200, 500); // test function
68 add_expected_result(
69 ".*", // compiler
70 ".*", // stdlib
71 ".*", // platform
72 largest_type, // test type(s)
73 ".*Integer.*", // test data group
74 ".*", 30, 15); // test function
75 add_expected_result(
76 ".*", // compiler
77 ".*", // stdlib
78 ".*", // platform
79 largest_type, // test type(s)
80 ".*", // test data group
81 ".*", 3, 3); // test function
82 add_expected_result(
83 ".*", // compiler
84 ".*", // stdlib
85 ".*Solaris.*", // platform
86 "real_concept", // test type(s)
87 ".*", // test data group
88 ".*", 60, 15); // test function
89 add_expected_result(
90 ".*", // compiler
91 ".*", // stdlib
92 ".*", // platform
93 "real_concept", // test type(s)
94 ".*", // test data group
95 ".*", 40, 15); // test function
96
97 std::cout << "Tests run with " << BOOST_COMPILER << ", "
98 << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl;
99}
100
101BOOST_AUTO_TEST_CASE( test_main )
102{
103 expected_results();
104 BOOST_MATH_CONTROL_FP;
105
106 test_spots(0.0f, "float");
107 test_spots(0.0, "double");
108#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
109 test_spots(0.0L, "long double");
110 test_spots(boost::math::concepts::real_concept(0.1), "real_concept");
111#else
112 std::cout << "<note>The long double tests have been disabled on this platform "
113 "either because the long double overloads of the usual math functions are "
114 "not available at all, or because they are too inaccurate for these tests "
115 "to pass.</note>" << std::endl;
116#endif
117
118 test_zeta(0.1F, "float");
119 test_zeta(0.1, "double");
120#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
121 test_zeta(0.1L, "long double");
122 test_zeta(boost::math::concepts::real_concept(0.1), "real_concept");
123#else
124 std::cout << "<note>The long double tests have been disabled on this platform "
125 "either because the long double overloads of the usual math functions are "
126 "not available at all, or because they are too inaccurate for these tests "
127 "to pass.</note>" << std::endl;
128#endif
129
130}
131
132
133