]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/special_functions/12_ellint_2/check_value.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / special_functions / 12_ellint_2 / check_value.cc
1 // { dg-do run { target c++11 } }
2 // { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
3 //
4 // Copyright (C) 2016-2022 Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
20
21 // ellint_2
22 // Compare against values generated by the GNU Scientific Library.
23 // The GSL can be found on the web: http://www.gnu.org/software/gsl/
24 #include <limits>
25 #include <cmath>
26 #if defined(__TEST_DEBUG)
27 # include <iostream>
28 # define VERIFY(A) \
29 if (!(A)) \
30 { \
31 std::cout << "line " << __LINE__ \
32 << " max_abs_frac = " << max_abs_frac \
33 << std::endl; \
34 }
35 #else
36 # include <testsuite_hooks.h>
37 #endif
38 #include <specfun_testcase.h>
39
40 // Test data for k=-0.90000000000000002.
41 // max(|f - f_Boost|): 6.6613381477509392e-16 at index 7
42 // max(|f - f_Boost| / |f_Boost|): 6.6116483711056727e-16
43 // mean(f - f_Boost): -8.6042284408449634e-17
44 // variance(f - f_Boost): 4.1543973284335233e-32
45 // stddev(f - f_Boost): 2.0382338748125847e-16
46 const testcase_ellint_2<double>
47 data001[10] =
48 {
49 { 0.0000000000000000, -0.90000000000000002, 0.0000000000000000, 0.0 },
50 { 0.17381690606167963, -0.90000000000000002, 0.17453292519943295, 0.0 },
51 { 0.34337919186972055, -0.90000000000000002, 0.34906585039886590, 0.0 },
52 { 0.50464268659856337, -0.90000000000000002, 0.52359877559829882, 0.0 },
53 { 0.65400003842368593, -0.90000000000000002, 0.69813170079773179, 0.0 },
54 { 0.78854928419904635, -0.90000000000000002, 0.87266462599716477, 0.0 },
55 { 0.90645698626315396, -0.90000000000000002, 1.0471975511965976, 0.0 },
56 { 1.0075154899135927, -0.90000000000000002, 1.2217304763960306, 0.0 },
57 { 1.0940135583194071, -0.90000000000000002, 1.3962634015954636, 0.0 },
58 { 1.1716970527816142, -0.90000000000000002, 1.5707963267948966, 0.0 },
59 };
60 const double toler001 = 2.5000000000000020e-13;
61
62 // Test data for k=-0.80000000000000004.
63 // max(|f - f_Boost|): 1.3322676295501878e-15 at index 9
64 // max(|f - f_Boost| / |f_Boost|): 1.0438106231598255e-15
65 // mean(f - f_Boost): 1.8318679906315082e-16
66 // variance(f - f_Boost): 1.6301071049293564e-31
67 // stddev(f - f_Boost): 4.0374584888632060e-16
68 const testcase_ellint_2<double>
69 data002[10] =
70 {
71 { 0.0000000000000000, -0.80000000000000004, 0.0000000000000000, 0.0 },
72 { 0.17396762274534805, -0.80000000000000004, 0.17453292519943295, 0.0 },
73 { 0.34458685226969321, -0.80000000000000004, 0.34906585039886590, 0.0 },
74 { 0.50872923654502433, -0.80000000000000004, 0.52359877559829882, 0.0 },
75 { 0.66372016539176226, -0.80000000000000004, 0.69813170079773179, 0.0 },
76 { 0.80760344410167406, -0.80000000000000004, 0.87266462599716477, 0.0 },
77 { 0.93945480372495072, -0.80000000000000004, 1.0471975511965976, 0.0 },
78 { 1.0597473310395040, -0.80000000000000004, 1.2217304763960306, 0.0 },
79 { 1.1706981862452359, -0.80000000000000004, 1.3962634015954636, 0.0 },
80 { 1.2763499431699064, -0.80000000000000004, 1.5707963267948966, 0.0 },
81 };
82 const double toler002 = 2.5000000000000020e-13;
83
84 // Test data for k=-0.69999999999999996.
85 // max(|f - f_Boost|): 6.6613381477509392e-16 at index 8
86 // max(|f - f_Boost| / |f_Boost|): 5.4138821888802831e-16
87 // mean(f - f_Boost): 1.9428902930940238e-17
88 // variance(f - f_Boost): 2.6524572947662036e-32
89 // stddev(f - f_Boost): 1.6286366368119696e-16
90 const testcase_ellint_2<double>
91 data003[10] =
92 {
93 { 0.0000000000000000, -0.69999999999999996, 0.0000000000000000, 0.0 },
94 { 0.17410041242702540, -0.69999999999999996, 0.17453292519943295, 0.0 },
95 { 0.34564605085764760, -0.69999999999999996, 0.34906585039886590, 0.0 },
96 { 0.51228495693314657, -0.69999999999999996, 0.52359877559829882, 0.0 },
97 { 0.67207654098799530, -0.69999999999999996, 0.69813170079773179, 0.0 },
98 { 0.82370932631556493, -0.69999999999999996, 0.87266462599716477, 0.0 },
99 { 0.96672313309452806, -0.69999999999999996, 1.0471975511965976, 0.0 },
100 { 1.1017090644949501, -0.69999999999999996, 1.2217304763960306, 0.0 },
101 { 1.2304180097292916, -0.69999999999999996, 1.3962634015954636, 0.0 },
102 { 1.3556611355719554, -0.69999999999999996, 1.5707963267948966, 0.0 },
103 };
104 const double toler003 = 2.5000000000000020e-13;
105
106 // Test data for k=-0.59999999999999998.
107 // max(|f - f_Boost|): 2.2204460492503131e-16 at index 7
108 // max(|f - f_Boost| / |f_Boost|): 1.9550519554437030e-16
109 // mean(f - f_Boost): 1.9428902930940238e-17
110 // variance(f - f_Boost): 4.6602749271592373e-35
111 // stddev(f - f_Boost): 6.8266206333435850e-18
112 const testcase_ellint_2<double>
113 data004[10] =
114 {
115 { 0.0000000000000000, -0.59999999999999998, 0.0000000000000000, 0.0 },
116 { 0.17421534919599127, -0.59999999999999998, 0.17453292519943295, 0.0 },
117 { 0.34655927787174096, -0.59999999999999998, 0.34906585039886590, 0.0 },
118 { 0.51533034538432143, -0.59999999999999998, 0.52359877559829882, 0.0 },
119 { 0.67916550597453018, -0.59999999999999998, 0.69813170079773179, 0.0 },
120 { 0.83720218180349881, -0.59999999999999998, 0.87266462599716477, 0.0 },
121 { 0.98922159354937755, -0.59999999999999998, 1.0471975511965976, 0.0 },
122 { 1.1357478470419362, -0.59999999999999998, 1.2217304763960306, 0.0 },
123 { 1.2780617372844061, -0.59999999999999998, 1.3962634015954636, 0.0 },
124 { 1.4180833944487241, -0.59999999999999998, 1.5707963267948966, 0.0 },
125 };
126 const double toler004 = 2.5000000000000020e-13;
127
128 // Test data for k=-0.50000000000000000.
129 // max(|f - f_Boost|): 4.4408920985006262e-16 at index 7
130 // max(|f - f_Boost| / |f_Boost|): 3.8178992821201131e-16
131 // mean(f - f_Boost): -4.9960036108132046e-17
132 // variance(f - f_Boost): 3.0133908324921077e-32
133 // stddev(f - f_Boost): 1.7359121039073689e-16
134 const testcase_ellint_2<double>
135 data005[10] =
136 {
137 { 0.0000000000000000, -0.50000000000000000, 0.0000000000000000, 0.0 },
138 { 0.17431249677315908, -0.50000000000000000, 0.17453292519943295, 0.0 },
139 { 0.34732862537770803, -0.50000000000000000, 0.34906585039886590, 0.0 },
140 { 0.51788193485993794, -0.50000000000000000, 0.52359877559829882, 0.0 },
141 { 0.68506022954164547, -0.50000000000000000, 0.69813170079773179, 0.0 },
142 { 0.84831662803347208, -0.50000000000000000, 0.87266462599716477, 0.0 },
143 { 1.0075555551444719, -0.50000000000000000, 1.0471975511965976, 0.0 },
144 { 1.1631768599287302, -0.50000000000000000, 1.2217304763960306, 0.0 },
145 { 1.3160584048772548, -0.50000000000000000, 1.3962634015954636, 0.0 },
146 { 1.4674622093394272, -0.50000000000000000, 1.5707963267948966, 0.0 },
147 };
148 const double toler005 = 2.5000000000000020e-13;
149
150 // Test data for k=-0.39999999999999991.
151 // max(|f - f_Boost|): 4.4408920985006262e-16 at index 9
152 // max(|f - f_Boost| / |f_Boost|): 2.9489138636265387e-16
153 // mean(f - f_Boost): 8.6042284408449634e-17
154 // variance(f - f_Boost): 1.5826864298542218e-32
155 // stddev(f - f_Boost): 1.2580486595733180e-16
156 const testcase_ellint_2<double>
157 data006[10] =
158 {
159 { 0.0000000000000000, -0.39999999999999991, 0.0000000000000000, 0.0 },
160 { 0.17439190872481267, -0.39999999999999991, 0.17453292519943295, 0.0 },
161 { 0.34795581767099210, -0.39999999999999991, 0.34906585039886590, 0.0 },
162 { 0.51995290683804463, -0.39999999999999991, 0.52359877559829882, 0.0 },
163 { 0.68981638464431527, -0.39999999999999991, 0.69813170079773179, 0.0 },
164 { 0.85722088859936030, -0.39999999999999991, 0.87266462599716477, 0.0 },
165 { 1.0221301327876993, -0.39999999999999991, 1.0471975511965976, 0.0 },
166 { 1.1848138019818375, -0.39999999999999991, 1.2217304763960306, 0.0 },
167 { 1.3458259266501533, -0.39999999999999991, 1.3962634015954636, 0.0 },
168 { 1.5059416123600404, -0.39999999999999991, 1.5707963267948966, 0.0 },
169 };
170 const double toler006 = 2.5000000000000020e-13;
171
172 // Test data for k=-0.29999999999999993.
173 // max(|f - f_Boost|): 6.6613381477509392e-16 at index 9
174 // max(|f - f_Boost| / |f_Boost|): 4.3401048387253188e-16
175 // mean(f - f_Boost): 7.2164496600635178e-17
176 // variance(f - f_Boost): 4.3555500115139682e-32
177 // stddev(f - f_Boost): 2.0869954507650391e-16
178 const testcase_ellint_2<double>
179 data007[10] =
180 {
181 { 0.0000000000000000, -0.29999999999999993, 0.0000000000000000, 0.0 },
182 { 0.17445362864048913, -0.29999999999999993, 0.17453292519943295, 0.0 },
183 { 0.34844223535713470, -0.29999999999999993, 0.34906585039886590, 0.0 },
184 { 0.52155353877411759, -0.29999999999999993, 0.52359877559829882, 0.0 },
185 { 0.69347584418369890, -0.29999999999999993, 0.69813170079773179, 0.0 },
186 { 0.86403609928237657, -0.29999999999999993, 0.87266462599716477, 0.0 },
187 { 1.0332234514065408, -0.29999999999999993, 1.0471975511965976, 0.0 },
188 { 1.2011943182068923, -0.29999999999999993, 1.2217304763960306, 0.0 },
189 { 1.3682566113689625, -0.29999999999999993, 1.3962634015954636, 0.0 },
190 { 1.5348334649232489, -0.29999999999999993, 1.5707963267948966, 0.0 },
191 };
192 const double toler007 = 2.5000000000000020e-13;
193
194 // Test data for k=-0.19999999999999996.
195 // max(|f - f_Boost|): 4.4408920985006262e-16 at index 6
196 // max(|f - f_Boost| / |f_Boost|): 4.2658819988515356e-16
197 // mean(f - f_Boost): -5.2735593669694933e-17
198 // variance(f - f_Boost): 3.0473442641042680e-32
199 // stddev(f - f_Boost): 1.7456644190978597e-16
200 const testcase_ellint_2<double>
201 data008[10] =
202 {
203 { 0.0000000000000000, -0.19999999999999996, 0.0000000000000000, 0.0 },
204 { 0.17449769027652809, -0.19999999999999996, 0.17453292519943295, 0.0 },
205 { 0.34878893400762090, -0.19999999999999996, 0.34906585039886590, 0.0 },
206 { 0.52269152856057410, -0.19999999999999996, 0.52359877559829882, 0.0 },
207 { 0.69606913360157574, -0.19999999999999996, 0.69813170079773179, 0.0 },
208 { 0.86884782374863379, -0.19999999999999996, 0.87266462599716477, 0.0 },
209 { 1.0410255369689567, -0.19999999999999996, 1.0471975511965976, 0.0 },
210 { 1.2126730391631364, -0.19999999999999996, 1.2217304763960306, 0.0 },
211 { 1.3839259540325151, -0.19999999999999996, 1.3962634015954636, 0.0 },
212 { 1.5549685462425293, -0.19999999999999996, 1.5707963267948966, 0.0 },
213 };
214 const double toler008 = 2.5000000000000020e-13;
215
216 // Test data for k=-0.099999999999999978.
217 // max(|f - f_Boost|): 4.4408920985006262e-16 at index 8
218 // max(|f - f_Boost| / |f_Boost|): 3.1875595485348024e-16
219 // mean(f - f_Boost): -4.7184478546569152e-17
220 // variance(f - f_Boost): 2.7486111305082032e-34
221 // stddev(f - f_Boost): 1.6578935823834422e-17
222 const testcase_ellint_2<double>
223 data009[10] =
224 {
225 { 0.0000000000000000, -0.099999999999999978, 0.0000000000000000, 0.0 },
226 { 0.17452411766649942, -0.099999999999999978, 0.17453292519943295, 0.0 },
227 { 0.34899665805442409, -0.099999999999999978, 0.34906585039886590, 0.0 },
228 { 0.52337222400508787, -0.099999999999999978, 0.52359877559829882, 0.0 },
229 { 0.69761705217284864, -0.099999999999999978, 0.69813170079773179, 0.0 },
230 { 0.87171309273007491, -0.099999999999999978, 0.87266462599716477, 0.0 },
231 { 1.0456602197056326, -0.099999999999999978, 1.0471975511965976, 0.0 },
232 { 1.2194762899272027, -0.099999999999999978, 1.2217304763960306, 0.0 },
233 { 1.3931950229892747, -0.099999999999999978, 1.3962634015954636, 0.0 },
234 { 1.5668619420216683, -0.099999999999999978, 1.5707963267948966, 0.0 },
235 };
236 const double toler009 = 2.5000000000000020e-13;
237
238 // Test data for k=0.0000000000000000.
239 // max(|f - f_Boost|): 2.2204460492503131e-16 at index 7
240 // max(|f - f_Boost| / |f_Boost|): 2.1203697876423447e-16
241 // mean(f - f_Boost): -1.9428902930940238e-17
242 // variance(f - f_Boost): 4.6602749271592373e-35
243 // stddev(f - f_Boost): 6.8266206333435850e-18
244 const testcase_ellint_2<double>
245 data010[10] =
246 {
247 { 0.0000000000000000, 0.0000000000000000, 0.0000000000000000, 0.0 },
248 { 0.17453292519943295, 0.0000000000000000, 0.17453292519943295, 0.0 },
249 { 0.34906585039886590, 0.0000000000000000, 0.34906585039886590, 0.0 },
250 { 0.52359877559829882, 0.0000000000000000, 0.52359877559829882, 0.0 },
251 { 0.69813170079773179, 0.0000000000000000, 0.69813170079773179, 0.0 },
252 { 0.87266462599716477, 0.0000000000000000, 0.87266462599716477, 0.0 },
253 { 1.0471975511965976, 0.0000000000000000, 1.0471975511965976, 0.0 },
254 { 1.2217304763960306, 0.0000000000000000, 1.2217304763960306, 0.0 },
255 { 1.3962634015954636, 0.0000000000000000, 1.3962634015954636, 0.0 },
256 { 1.5707963267948966, 0.0000000000000000, 1.5707963267948966, 0.0 },
257 };
258 const double toler010 = 2.5000000000000020e-13;
259
260 // Test data for k=0.10000000000000009.
261 // max(|f - f_Boost|): 4.4408920985006262e-16 at index 8
262 // max(|f - f_Boost| / |f_Boost|): 3.1875595485348024e-16
263 // mean(f - f_Boost): -4.7184478546569152e-17
264 // variance(f - f_Boost): 2.7486111305082032e-34
265 // stddev(f - f_Boost): 1.6578935823834422e-17
266 const testcase_ellint_2<double>
267 data011[10] =
268 {
269 { 0.0000000000000000, 0.10000000000000009, 0.0000000000000000, 0.0 },
270 { 0.17452411766649942, 0.10000000000000009, 0.17453292519943295, 0.0 },
271 { 0.34899665805442409, 0.10000000000000009, 0.34906585039886590, 0.0 },
272 { 0.52337222400508787, 0.10000000000000009, 0.52359877559829882, 0.0 },
273 { 0.69761705217284864, 0.10000000000000009, 0.69813170079773179, 0.0 },
274 { 0.87171309273007491, 0.10000000000000009, 0.87266462599716477, 0.0 },
275 { 1.0456602197056326, 0.10000000000000009, 1.0471975511965976, 0.0 },
276 { 1.2194762899272027, 0.10000000000000009, 1.2217304763960306, 0.0 },
277 { 1.3931950229892747, 0.10000000000000009, 1.3962634015954636, 0.0 },
278 { 1.5668619420216683, 0.10000000000000009, 1.5707963267948966, 0.0 },
279 };
280 const double toler011 = 2.5000000000000020e-13;
281
282 // Test data for k=0.20000000000000018.
283 // max(|f - f_Boost|): 4.4408920985006262e-16 at index 6
284 // max(|f - f_Boost| / |f_Boost|): 4.2658819988515356e-16
285 // mean(f - f_Boost): -5.2735593669694933e-17
286 // variance(f - f_Boost): 3.0473442641042680e-32
287 // stddev(f - f_Boost): 1.7456644190978597e-16
288 const testcase_ellint_2<double>
289 data012[10] =
290 {
291 { 0.0000000000000000, 0.20000000000000018, 0.0000000000000000, 0.0 },
292 { 0.17449769027652809, 0.20000000000000018, 0.17453292519943295, 0.0 },
293 { 0.34878893400762090, 0.20000000000000018, 0.34906585039886590, 0.0 },
294 { 0.52269152856057410, 0.20000000000000018, 0.52359877559829882, 0.0 },
295 { 0.69606913360157574, 0.20000000000000018, 0.69813170079773179, 0.0 },
296 { 0.86884782374863379, 0.20000000000000018, 0.87266462599716477, 0.0 },
297 { 1.0410255369689567, 0.20000000000000018, 1.0471975511965976, 0.0 },
298 { 1.2126730391631364, 0.20000000000000018, 1.2217304763960306, 0.0 },
299 { 1.3839259540325151, 0.20000000000000018, 1.3962634015954636, 0.0 },
300 { 1.5549685462425291, 0.20000000000000018, 1.5707963267948966, 0.0 },
301 };
302 const double toler012 = 2.5000000000000020e-13;
303
304 // Test data for k=0.30000000000000004.
305 // max(|f - f_Boost|): 6.6613381477509392e-16 at index 9
306 // max(|f - f_Boost| / |f_Boost|): 4.3401048387253188e-16
307 // mean(f - f_Boost): 7.2164496600635178e-17
308 // variance(f - f_Boost): 4.3555500115139682e-32
309 // stddev(f - f_Boost): 2.0869954507650391e-16
310 const testcase_ellint_2<double>
311 data013[10] =
312 {
313 { 0.0000000000000000, 0.30000000000000004, 0.0000000000000000, 0.0 },
314 { 0.17445362864048913, 0.30000000000000004, 0.17453292519943295, 0.0 },
315 { 0.34844223535713470, 0.30000000000000004, 0.34906585039886590, 0.0 },
316 { 0.52155353877411759, 0.30000000000000004, 0.52359877559829882, 0.0 },
317 { 0.69347584418369890, 0.30000000000000004, 0.69813170079773179, 0.0 },
318 { 0.86403609928237657, 0.30000000000000004, 0.87266462599716477, 0.0 },
319 { 1.0332234514065408, 0.30000000000000004, 1.0471975511965976, 0.0 },
320 { 1.2011943182068923, 0.30000000000000004, 1.2217304763960306, 0.0 },
321 { 1.3682566113689625, 0.30000000000000004, 1.3962634015954636, 0.0 },
322 { 1.5348334649232489, 0.30000000000000004, 1.5707963267948966, 0.0 },
323 };
324 const double toler013 = 2.5000000000000020e-13;
325
326 // Test data for k=0.40000000000000013.
327 // max(|f - f_Boost|): 1.7763568394002505e-15 at index 9
328 // max(|f - f_Boost| / |f_Boost|): 1.1795655454506157e-15
329 // mean(f - f_Boost): 2.0816681711721685e-16
330 // variance(f - f_Boost): 3.0360740073926687e-31
331 // stddev(f - f_Boost): 5.5100580826273227e-16
332 const testcase_ellint_2<double>
333 data014[10] =
334 {
335 { 0.0000000000000000, 0.40000000000000013, 0.0000000000000000, 0.0 },
336 { 0.17439190872481267, 0.40000000000000013, 0.17453292519943295, 0.0 },
337 { 0.34795581767099210, 0.40000000000000013, 0.34906585039886590, 0.0 },
338 { 0.51995290683804463, 0.40000000000000013, 0.52359877559829882, 0.0 },
339 { 0.68981638464431527, 0.40000000000000013, 0.69813170079773179, 0.0 },
340 { 0.85722088859936030, 0.40000000000000013, 0.87266462599716477, 0.0 },
341 { 1.0221301327876993, 0.40000000000000013, 1.0471975511965976, 0.0 },
342 { 1.1848138019818375, 0.40000000000000013, 1.2217304763960306, 0.0 },
343 { 1.3458259266501531, 0.40000000000000013, 1.3962634015954636, 0.0 },
344 { 1.5059416123600402, 0.40000000000000013, 1.5707963267948966, 0.0 },
345 };
346 const double toler014 = 2.5000000000000020e-13;
347
348 // Test data for k=0.50000000000000000.
349 // max(|f - f_Boost|): 4.4408920985006262e-16 at index 7
350 // max(|f - f_Boost| / |f_Boost|): 3.8178992821201131e-16
351 // mean(f - f_Boost): -4.9960036108132046e-17
352 // variance(f - f_Boost): 3.0133908324921077e-32
353 // stddev(f - f_Boost): 1.7359121039073689e-16
354 const testcase_ellint_2<double>
355 data015[10] =
356 {
357 { 0.0000000000000000, 0.50000000000000000, 0.0000000000000000, 0.0 },
358 { 0.17431249677315908, 0.50000000000000000, 0.17453292519943295, 0.0 },
359 { 0.34732862537770803, 0.50000000000000000, 0.34906585039886590, 0.0 },
360 { 0.51788193485993794, 0.50000000000000000, 0.52359877559829882, 0.0 },
361 { 0.68506022954164547, 0.50000000000000000, 0.69813170079773179, 0.0 },
362 { 0.84831662803347208, 0.50000000000000000, 0.87266462599716477, 0.0 },
363 { 1.0075555551444719, 0.50000000000000000, 1.0471975511965976, 0.0 },
364 { 1.1631768599287302, 0.50000000000000000, 1.2217304763960306, 0.0 },
365 { 1.3160584048772548, 0.50000000000000000, 1.3962634015954636, 0.0 },
366 { 1.4674622093394272, 0.50000000000000000, 1.5707963267948966, 0.0 },
367 };
368 const double toler015 = 2.5000000000000020e-13;
369
370 // Test data for k=0.60000000000000009.
371 // max(|f - f_Boost|): 4.4408920985006262e-16 at index 7
372 // max(|f - f_Boost| / |f_Boost|): 3.9101039108874066e-16
373 // mean(f - f_Boost): 1.9428902930940238e-17
374 // variance(f - f_Boost): 7.1986981476874020e-33
375 // stddev(f - f_Boost): 8.4845142157270271e-17
376 const testcase_ellint_2<double>
377 data016[10] =
378 {
379 { 0.0000000000000000, 0.60000000000000009, 0.0000000000000000, 0.0 },
380 { 0.17421534919599127, 0.60000000000000009, 0.17453292519943295, 0.0 },
381 { 0.34655927787174096, 0.60000000000000009, 0.34906585039886590, 0.0 },
382 { 0.51533034538432143, 0.60000000000000009, 0.52359877559829882, 0.0 },
383 { 0.67916550597453018, 0.60000000000000009, 0.69813170079773179, 0.0 },
384 { 0.83720218180349881, 0.60000000000000009, 0.87266462599716477, 0.0 },
385 { 0.98922159354937755, 0.60000000000000009, 1.0471975511965976, 0.0 },
386 { 1.1357478470419360, 0.60000000000000009, 1.2217304763960306, 0.0 },
387 { 1.2780617372844061, 0.60000000000000009, 1.3962634015954636, 0.0 },
388 { 1.4180833944487241, 0.60000000000000009, 1.5707963267948966, 0.0 },
389 };
390 const double toler016 = 2.5000000000000020e-13;
391
392 // Test data for k=0.70000000000000018.
393 // max(|f - f_Boost|): 4.4408920985006262e-16 at index 6
394 // max(|f - f_Boost| / |f_Boost|): 4.5937579711009016e-16
395 // mean(f - f_Boost): 6.1062266354383615e-17
396 // variance(f - f_Boost): 1.8112301165881739e-32
397 // stddev(f - f_Boost): 1.3458194962877355e-16
398 const testcase_ellint_2<double>
399 data017[10] =
400 {
401 { 0.0000000000000000, 0.70000000000000018, 0.0000000000000000, 0.0 },
402 { 0.17410041242702540, 0.70000000000000018, 0.17453292519943295, 0.0 },
403 { 0.34564605085764760, 0.70000000000000018, 0.34906585039886590, 0.0 },
404 { 0.51228495693314657, 0.70000000000000018, 0.52359877559829882, 0.0 },
405 { 0.67207654098799519, 0.70000000000000018, 0.69813170079773179, 0.0 },
406 { 0.82370932631556493, 0.70000000000000018, 0.87266462599716477, 0.0 },
407 { 0.96672313309452806, 0.70000000000000018, 1.0471975511965976, 0.0 },
408 { 1.1017090644949501, 0.70000000000000018, 1.2217304763960306, 0.0 },
409 { 1.2304180097292916, 0.70000000000000018, 1.3962634015954636, 0.0 },
410 { 1.3556611355719552, 0.70000000000000018, 1.5707963267948966, 0.0 },
411 };
412 const double toler017 = 2.5000000000000020e-13;
413
414 // Test data for k=0.80000000000000004.
415 // max(|f - f_Boost|): 1.3322676295501878e-15 at index 9
416 // max(|f - f_Boost| / |f_Boost|): 1.0438106231598255e-15
417 // mean(f - f_Boost): 1.8318679906315082e-16
418 // variance(f - f_Boost): 1.6301071049293564e-31
419 // stddev(f - f_Boost): 4.0374584888632060e-16
420 const testcase_ellint_2<double>
421 data018[10] =
422 {
423 { 0.0000000000000000, 0.80000000000000004, 0.0000000000000000, 0.0 },
424 { 0.17396762274534805, 0.80000000000000004, 0.17453292519943295, 0.0 },
425 { 0.34458685226969321, 0.80000000000000004, 0.34906585039886590, 0.0 },
426 { 0.50872923654502433, 0.80000000000000004, 0.52359877559829882, 0.0 },
427 { 0.66372016539176226, 0.80000000000000004, 0.69813170079773179, 0.0 },
428 { 0.80760344410167406, 0.80000000000000004, 0.87266462599716477, 0.0 },
429 { 0.93945480372495072, 0.80000000000000004, 1.0471975511965976, 0.0 },
430 { 1.0597473310395040, 0.80000000000000004, 1.2217304763960306, 0.0 },
431 { 1.1706981862452359, 0.80000000000000004, 1.3962634015954636, 0.0 },
432 { 1.2763499431699064, 0.80000000000000004, 1.5707963267948966, 0.0 },
433 };
434 const double toler018 = 2.5000000000000020e-13;
435
436 // Test data for k=0.90000000000000013.
437 // max(|f - f_Boost|): 6.6613381477509392e-16 at index 7
438 // max(|f - f_Boost| / |f_Boost|): 6.6116483711056727e-16
439 // mean(f - f_Boost): 1.3877787807814457e-17
440 // variance(f - f_Boost): 2.3776912893669577e-35
441 // stddev(f - f_Boost): 4.8761575952454181e-18
442 const testcase_ellint_2<double>
443 data019[10] =
444 {
445 { 0.0000000000000000, 0.90000000000000013, 0.0000000000000000, 0.0 },
446 { 0.17381690606167963, 0.90000000000000013, 0.17453292519943295, 0.0 },
447 { 0.34337919186972055, 0.90000000000000013, 0.34906585039886590, 0.0 },
448 { 0.50464268659856337, 0.90000000000000013, 0.52359877559829882, 0.0 },
449 { 0.65400003842368593, 0.90000000000000013, 0.69813170079773179, 0.0 },
450 { 0.78854928419904635, 0.90000000000000013, 0.87266462599716477, 0.0 },
451 { 0.90645698626315385, 0.90000000000000013, 1.0471975511965976, 0.0 },
452 { 1.0075154899135927, 0.90000000000000013, 1.2217304763960306, 0.0 },
453 { 1.0940135583194068, 0.90000000000000013, 1.3962634015954636, 0.0 },
454 { 1.1716970527816140, 0.90000000000000013, 1.5707963267948966, 0.0 },
455 };
456 const double toler019 = 2.5000000000000020e-13;
457
458 template<typename Ret, unsigned int Num>
459 void
460 test(const testcase_ellint_2<Ret> (&data)[Num], Ret toler)
461 {
462 bool test __attribute__((unused)) = true;
463 const Ret eps = std::numeric_limits<Ret>::epsilon();
464 Ret max_abs_diff = -Ret(1);
465 Ret max_abs_frac = -Ret(1);
466 unsigned int num_datum = Num;
467 for (unsigned int i = 0; i < num_datum; ++i)
468 {
469 const Ret f = std::ellint_2(data[i].k, data[i].phi);
470 const Ret f0 = data[i].f0;
471 const Ret diff = f - f0;
472 if (std::abs(diff) > max_abs_diff)
473 max_abs_diff = std::abs(diff);
474 if (std::abs(f0) > Ret(10) * eps
475 && std::abs(f) > Ret(10) * eps)
476 {
477 const Ret frac = diff / f0;
478 if (std::abs(frac) > max_abs_frac)
479 max_abs_frac = std::abs(frac);
480 }
481 }
482 VERIFY(max_abs_frac < toler);
483 }
484
485 int
486 main()
487 {
488 test(data001, toler001);
489 test(data002, toler002);
490 test(data003, toler003);
491 test(data004, toler004);
492 test(data005, toler005);
493 test(data006, toler006);
494 test(data007, toler007);
495 test(data008, toler008);
496 test(data009, toler009);
497 test(data010, toler010);
498 test(data011, toler011);
499 test(data012, toler012);
500 test(data013, toler013);
501 test(data014, toler014);
502 test(data015, toler015);
503 test(data016, toler016);
504 test(data017, toler017);
505 test(data018, toler018);
506 test(data019, toler019);
507 return 0;
508 }