]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/special_functions/06_comp_ellint_3/check_value.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / special_functions / 06_comp_ellint_3 / check_value.cc
CommitLineData
196c9e7a 1// { dg-do run { target c++11 } }
2be75957
ESR
2// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
3//
a945c346 4// Copyright (C) 2016-2024 Free Software Foundation, Inc.
2be75957
ESR
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// comp_ellint_3
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
2be75957 40// Test data for k=-0.90000000000000002.
b4688136
ESR
41// max(|f - f_Boost|): 4.4408920985006262e-16 at index 5
42// max(|f - f_Boost| / |f_Boost|): 1.2838262090802751e-16
43// mean(f - f_Boost): 4.4408920985006264e-17
44// variance(f - f_Boost): 2.4347558803117648e-34
45// stddev(f - f_Boost): 1.5603704304785339e-17
2be75957
ESR
46const testcase_comp_ellint_3<double>
47data001[10] =
48{
b4688136
ESR
49 { 2.2805491384227703, -0.90000000000000002, 0.0000000000000000, 0.0 },
50 { 2.4295011187834885, -0.90000000000000002, 0.10000000000000001, 0.0 },
51 { 2.6076835743348412, -0.90000000000000002, 0.20000000000000001, 0.0 },
52 { 2.8256506968858512, -0.90000000000000002, 0.30000000000000004, 0.0 },
53 { 3.1000689868578619, -0.90000000000000002, 0.40000000000000002, 0.0 },
54 { 3.4591069002104677, -0.90000000000000002, 0.50000000000000000, 0.0 },
55 { 3.9549939883570229, -0.90000000000000002, 0.60000000000000009, 0.0 },
56 { 4.6985482312992435, -0.90000000000000002, 0.70000000000000007, 0.0 },
57 { 5.9820740813645710, -0.90000000000000002, 0.80000000000000004, 0.0 },
58 { 8.9942562031858699, -0.90000000000000002, 0.90000000000000002, 0.0 },
2be75957
ESR
59};
60const double toler001 = 2.5000000000000020e-13;
61
62// Test data for k=-0.80000000000000004.
b4688136
ESR
63// max(|f - f_Boost|): 1.7763568394002505e-15 at index 8
64// max(|f - f_Boost| / |f_Boost|): 4.1949393471095187e-16
65// mean(f - f_Boost): 9.5479180117763459e-16
66// variance(f - f_Boost): 5.4782007307014711e-34
67// stddev(f - f_Boost): 2.3405556457178006e-17
2be75957
ESR
68const testcase_comp_ellint_3<double>
69data002[10] =
70{
b4688136
ESR
71 { 1.9953027776647294, -0.80000000000000004, 0.0000000000000000, 0.0 },
72 { 2.1172616484005085, -0.80000000000000004, 0.10000000000000001, 0.0 },
73 { 2.2624789434186798, -0.80000000000000004, 0.20000000000000001, 0.0 },
74 { 2.4392042002725698, -0.80000000000000004, 0.30000000000000004, 0.0 },
75 { 2.6604037035529728, -0.80000000000000004, 0.40000000000000002, 0.0 },
76 { 2.9478781158239751, -0.80000000000000004, 0.50000000000000000, 0.0 },
77 { 3.3418121892288055, -0.80000000000000004, 0.60000000000000009, 0.0 },
78 { 3.9268876980046397, -0.80000000000000004, 0.70000000000000007, 0.0 },
79 { 4.9246422058196071, -0.80000000000000004, 0.80000000000000004, 0.0 },
80 { 7.2263259298637132, -0.80000000000000004, 0.90000000000000002, 0.0 },
2be75957
ESR
81};
82const double toler002 = 2.5000000000000020e-13;
83
84// Test data for k=-0.69999999999999996.
b4688136
ESR
85// max(|f - f_Boost|): 4.4408920985006262e-16 at index 3
86// max(|f - f_Boost| / |f_Boost|): 1.9832236886714888e-16
87// mean(f - f_Boost): -1.5543122344752191e-16
88// variance(f - f_Boost): 2.9825759533819119e-33
89// stddev(f - f_Boost): 5.4612965066748680e-17
2be75957
ESR
90const testcase_comp_ellint_3<double>
91data003[10] =
92{
b4688136
ESR
93 { 1.8456939983747234, -0.69999999999999996, 0.0000000000000000, 0.0 },
94 { 1.9541347343119564, -0.69999999999999996, 0.10000000000000001, 0.0 },
95 { 2.0829290325820202, -0.69999999999999996, 0.20000000000000001, 0.0 },
96 { 2.2392290510988535, -0.69999999999999996, 0.30000000000000004, 0.0 },
97 { 2.4342502915307880, -0.69999999999999996, 0.40000000000000002, 0.0 },
98 { 2.6868019968236996, -0.69999999999999996, 0.50000000000000000, 0.0 },
99 { 3.0314573496746742, -0.69999999999999996, 0.60000000000000009, 0.0 },
100 { 3.5408408771788564, -0.69999999999999996, 0.70000000000000007, 0.0 },
101 { 4.4042405729076961, -0.69999999999999996, 0.80000000000000004, 0.0 },
102 { 6.3796094177887754, -0.69999999999999996, 0.90000000000000002, 0.0 },
2be75957
ESR
103};
104const double toler003 = 2.5000000000000020e-13;
105
106// Test data for k=-0.59999999999999998.
b4688136
ESR
107// max(|f - f_Boost|): 4.4408920985006262e-16 at index 2
108// max(|f - f_Boost| / |f_Boost|): 2.2547200163366559e-16
109// mean(f - f_Boost): -1.9984014443252818e-16
110// variance(f - f_Boost): 4.9303806576313241e-33
111// stddev(f - f_Boost): 7.0216669371534022e-17
2be75957
ESR
112const testcase_comp_ellint_3<double>
113data004[10] =
114{
b4688136
ESR
115 { 1.7507538029157526, -0.59999999999999998, 0.0000000000000000, 0.0 },
116 { 1.8508766487100685, -0.59999999999999998, 0.10000000000000001, 0.0 },
117 { 1.9695980282802217, -0.59999999999999998, 0.20000000000000001, 0.0 },
118 { 2.1134154405060599, -0.59999999999999998, 0.30000000000000004, 0.0 },
119 { 2.2925036420985130, -0.59999999999999998, 0.40000000000000002, 0.0 },
120 { 2.5239007084492711, -0.59999999999999998, 0.50000000000000000, 0.0 },
121 { 2.8388723099514972, -0.59999999999999998, 0.60000000000000009, 0.0 },
122 { 3.3029735898397159, -0.59999999999999998, 0.70000000000000007, 0.0 },
123 { 4.0867036409261832, -0.59999999999999998, 0.80000000000000004, 0.0 },
124 { 5.8709993116265604, -0.59999999999999998, 0.90000000000000002, 0.0 },
2be75957
ESR
125};
126const double toler004 = 2.5000000000000020e-13;
127
128// Test data for k=-0.50000000000000000.
b4688136
ESR
129// max(|f - f_Boost|): 4.4408920985006262e-16 at index 3
130// max(|f - f_Boost| / |f_Boost|): 2.1900131385114407e-16
131// mean(f - f_Boost): 2.4424906541753446e-16
132// variance(f - f_Boost): 7.3651365379430888e-33
133// stddev(f - f_Boost): 8.5820373676319358e-17
2be75957
ESR
134const testcase_comp_ellint_3<double>
135data005[10] =
136{
b4688136
ESR
137 { 1.6857503548125961, -0.50000000000000000, 0.0000000000000000, 0.0 },
138 { 1.7803034946545482, -0.50000000000000000, 0.10000000000000001, 0.0 },
139 { 1.8922947612264021, -0.50000000000000000, 0.20000000000000001, 0.0 },
140 { 2.0277924458111314, -0.50000000000000000, 0.30000000000000004, 0.0 },
141 { 2.1962905366178065, -0.50000000000000000, 0.40000000000000002, 0.0 },
142 { 2.4136715042011945, -0.50000000000000000, 0.50000000000000000, 0.0 },
143 { 2.7090491861753558, -0.50000000000000000, 0.60000000000000009, 0.0 },
144 { 3.1433945297859229, -0.50000000000000000, 0.70000000000000007, 0.0 },
145 { 3.8750701888108070, -0.50000000000000000, 0.80000000000000004, 0.0 },
146 { 5.5355132096026463, -0.50000000000000000, 0.90000000000000002, 0.0 },
2be75957
ESR
147};
148const double toler005 = 2.5000000000000020e-13;
149
b4688136
ESR
150// Test data for k=-0.39999999999999991.
151// max(|f - f_Boost|): 1.7763568394002505e-15 at index 9
152// max(|f - f_Boost| / |f_Boost|): 4.1718164615986397e-16
153// mean(f - f_Boost): 6.2172489379008762e-16
154// variance(f - f_Boost): 1.6458949750907531e-31
155// stddev(f - f_Boost): 4.0569631192441877e-16
2be75957
ESR
156const testcase_comp_ellint_3<double>
157data006[10] =
158{
b4688136
ESR
159 { 1.6399998658645112, -0.39999999999999991, 0.0000000000000000, 0.0 },
160 { 1.7306968836847190, -0.39999999999999991, 0.10000000000000001, 0.0 },
161 { 1.8380358826317627, -0.39999999999999991, 0.20000000000000001, 0.0 },
162 { 1.9677924132520139, -0.39999999999999991, 0.30000000000000004, 0.0 },
163 { 2.1289968719280026, -0.39999999999999991, 0.40000000000000002, 0.0 },
164 { 2.3367461373176512, -0.39999999999999991, 0.50000000000000000, 0.0 },
165 { 2.6186940209850191, -0.39999999999999991, 0.60000000000000009, 0.0 },
166 { 3.0327078743873246, -0.39999999999999991, 0.70000000000000007, 0.0 },
167 { 3.7289548002199902, -0.39999999999999991, 0.80000000000000004, 0.0 },
168 { 5.3055535102872513, -0.39999999999999991, 0.90000000000000002, 0.0 },
2be75957
ESR
169};
170const double toler006 = 2.5000000000000020e-13;
171
b4688136
ESR
172// Test data for k=-0.29999999999999993.
173// max(|f - f_Boost|): 1.3322676295501878e-15 at index 8
174// max(|f - f_Boost| / |f_Boost|): 3.9274792319434433e-16
175// mean(f - f_Boost): 6.2172489379008762e-16
176// variance(f - f_Boost): 8.7651211691223537e-33
177// stddev(f - f_Boost): 9.3622225828712025e-17
2be75957
ESR
178const testcase_comp_ellint_3<double>
179data007[10] =
180{
b4688136
ESR
181 { 1.6080486199305128, -0.29999999999999993, 0.0000000000000000, 0.0 },
182 { 1.6960848815118226, -0.29999999999999993, 0.10000000000000001, 0.0 },
183 { 1.8002173372290500, -0.29999999999999993, 0.20000000000000001, 0.0 },
184 { 1.9260216862473254, -0.29999999999999993, 0.30000000000000004, 0.0 },
185 { 2.0822121773175533, -0.29999999999999993, 0.40000000000000002, 0.0 },
186 { 2.2833505881933971, -0.29999999999999993, 0.50000000000000000, 0.0 },
187 { 2.5560975528589065, -0.29999999999999993, 0.60000000000000009, 0.0 },
188 { 2.9562123549913877, -0.29999999999999993, 0.70000000000000007, 0.0 },
189 { 3.6283050484567170, -0.29999999999999993, 0.80000000000000004, 0.0 },
190 { 5.1479514944016795, -0.29999999999999993, 0.90000000000000002, 0.0 },
2be75957
ESR
191};
192const double toler007 = 2.5000000000000020e-13;
193
194// Test data for k=-0.19999999999999996.
b4688136
ESR
195// max(|f - f_Boost|): 8.8817841970012523e-16 at index 9
196// max(|f - f_Boost| / |f_Boost|): 1.9753938705764407e-16
197// mean(f - f_Boost): 3.1086244689504381e-16
198// variance(f - f_Boost): 4.1147374377268827e-32
199// stddev(f - f_Boost): 2.0284815596220939e-16
2be75957
ESR
200const testcase_comp_ellint_3<double>
201data008[10] =
202{
b4688136
ESR
203 { 1.5868678474541662, -0.19999999999999996, 0.0000000000000000, 0.0 },
204 { 1.6731552050562593, -0.19999999999999996, 0.10000000000000001, 0.0 },
205 { 1.7751816279738935, -0.19999999999999996, 0.20000000000000001, 0.0 },
206 { 1.8983924169967101, -0.19999999999999996, 0.30000000000000004, 0.0 },
207 { 2.0512956926676806, -0.19999999999999996, 0.40000000000000002, 0.0 },
208 { 2.2481046259421302, -0.19999999999999996, 0.50000000000000000, 0.0 },
209 { 2.5148333891629315, -0.19999999999999996, 0.60000000000000009, 0.0 },
210 { 2.9058704854500967, -0.19999999999999996, 0.70000000000000007, 0.0 },
211 { 3.5622166386422633, -0.19999999999999996, 0.80000000000000004, 0.0 },
212 { 5.0448269356200370, -0.19999999999999996, 0.90000000000000002, 0.0 },
2be75957
ESR
213};
214const double toler008 = 2.5000000000000020e-13;
215
216// Test data for k=-0.099999999999999978.
b4688136
ESR
217// max(|f - f_Boost|): 4.4408920985006262e-16 at index 5
218// max(|f - f_Boost| / |f_Boost|): 1.9932308021417639e-16
219// mean(f - f_Boost): 0.0000000000000000
220// variance(f - f_Boost): 6.8368087769470551e-64
221// stddev(f - f_Boost): 2.6147291976315738e-32
2be75957
ESR
222const testcase_comp_ellint_3<double>
223data009[10] =
224{
b4688136
ESR
225 { 1.5747455615173560, -0.099999999999999978, 0.0000000000000000, 0.0 },
226 { 1.6600374067558428, -0.099999999999999978, 0.10000000000000001, 0.0 },
227 { 1.7608656115083421, -0.099999999999999978, 0.20000000000000001, 0.0 },
228 { 1.8826015946315438, -0.099999999999999978, 0.30000000000000004, 0.0 },
229 { 2.0336367403076760, -0.099999999999999978, 0.40000000000000002, 0.0 },
230 { 2.2279868912966849, -0.099999999999999978, 0.50000000000000000, 0.0 },
231 { 2.4913004919173827, -0.099999999999999978, 0.60000000000000009, 0.0 },
232 { 2.8771910188009744, -0.099999999999999978, 0.70000000000000007, 0.0 },
233 { 3.5246199613295617, -0.099999999999999978, 0.80000000000000004, 0.0 },
234 { 4.9862890417305508, -0.099999999999999978, 0.90000000000000002, 0.0 },
2be75957
ESR
235};
236const double toler009 = 2.5000000000000020e-13;
237
238// Test data for k=0.0000000000000000.
b4688136
ESR
239// max(|f - f_Boost|): 8.8817841970012523e-16 at index 9
240// max(|f - f_Boost| / |f_Boost|): 2.1899085000907084e-16
241// mean(f - f_Boost): -2.2204460492503131e-16
242// variance(f - f_Boost): 5.4782007307014711e-32
243// stddev(f - f_Boost): 2.3405556457178008e-16
2be75957
ESR
244const testcase_comp_ellint_3<double>
245data010[10] =
246{
b4688136
ESR
247 { 1.5707963267948966, 0.0000000000000000, 0.0000000000000000, 0.0 },
248 { 1.6557647109660170, 0.0000000000000000, 0.10000000000000001, 0.0 },
249 { 1.7562036827601817, 0.0000000000000000, 0.20000000000000001, 0.0 },
250 { 1.8774607092226381, 0.0000000000000000, 0.30000000000000004, 0.0 },
251 { 2.0278893379868062, 0.0000000000000000, 0.40000000000000002, 0.0 },
252 { 2.2214414690791831, 0.0000000000000000, 0.50000000000000000, 0.0 },
253 { 2.4836470664490258, 0.0000000000000000, 0.60000000000000009, 0.0 },
254 { 2.8678686047727386, 0.0000000000000000, 0.70000000000000007, 0.0 },
255 { 3.5124073655203634, 0.0000000000000000, 0.80000000000000004, 0.0 },
256 { 4.9672941328980516, 0.0000000000000000, 0.90000000000000002, 0.0 },
2be75957
ESR
257};
258const double toler010 = 2.5000000000000020e-13;
259
260// Test data for k=0.10000000000000009.
b4688136
ESR
261// max(|f - f_Boost|): 4.4408920985006262e-16 at index 5
262// max(|f - f_Boost| / |f_Boost|): 1.9932308021417639e-16
263// mean(f - f_Boost): -2.2204460492503132e-17
264// variance(f - f_Boost): 6.0868897007794120e-35
265// stddev(f - f_Boost): 7.8018521523926693e-18
2be75957
ESR
266const testcase_comp_ellint_3<double>
267data011[10] =
268{
b4688136
ESR
269 { 1.5747455615173560, 0.10000000000000009, 0.0000000000000000, 0.0 },
270 { 1.6600374067558428, 0.10000000000000009, 0.10000000000000001, 0.0 },
271 { 1.7608656115083421, 0.10000000000000009, 0.20000000000000001, 0.0 },
272 { 1.8826015946315440, 0.10000000000000009, 0.30000000000000004, 0.0 },
273 { 2.0336367403076760, 0.10000000000000009, 0.40000000000000002, 0.0 },
274 { 2.2279868912966849, 0.10000000000000009, 0.50000000000000000, 0.0 },
275 { 2.4913004919173827, 0.10000000000000009, 0.60000000000000009, 0.0 },
276 { 2.8771910188009744, 0.10000000000000009, 0.70000000000000007, 0.0 },
277 { 3.5246199613295617, 0.10000000000000009, 0.80000000000000004, 0.0 },
278 { 4.9862890417305508, 0.10000000000000009, 0.90000000000000002, 0.0 },
2be75957
ESR
279};
280const double toler011 = 2.5000000000000020e-13;
281
b4688136
ESR
282// Test data for k=0.20000000000000018.
283// max(|f - f_Boost|): 8.8817841970012523e-16 at index 9
284// max(|f - f_Boost| / |f_Boost|): 1.9753938705764407e-16
285// mean(f - f_Boost): 3.1086244689504381e-16
286// variance(f - f_Boost): 4.1147374377268827e-32
287// stddev(f - f_Boost): 2.0284815596220939e-16
2be75957
ESR
288const testcase_comp_ellint_3<double>
289data012[10] =
290{
b4688136
ESR
291 { 1.5868678474541662, 0.20000000000000018, 0.0000000000000000, 0.0 },
292 { 1.6731552050562593, 0.20000000000000018, 0.10000000000000001, 0.0 },
293 { 1.7751816279738935, 0.20000000000000018, 0.20000000000000001, 0.0 },
294 { 1.8983924169967101, 0.20000000000000018, 0.30000000000000004, 0.0 },
295 { 2.0512956926676806, 0.20000000000000018, 0.40000000000000002, 0.0 },
296 { 2.2481046259421302, 0.20000000000000018, 0.50000000000000000, 0.0 },
297 { 2.5148333891629315, 0.20000000000000018, 0.60000000000000009, 0.0 },
298 { 2.9058704854500967, 0.20000000000000018, 0.70000000000000007, 0.0 },
299 { 3.5622166386422633, 0.20000000000000018, 0.80000000000000004, 0.0 },
300 { 5.0448269356200370, 0.20000000000000018, 0.90000000000000002, 0.0 },
2be75957
ESR
301};
302const double toler012 = 2.5000000000000020e-13;
303
304// Test data for k=0.30000000000000004.
b4688136
ESR
305// max(|f - f_Boost|): 8.8817841970012523e-16 at index 8
306// max(|f - f_Boost| / |f_Boost|): 3.4585997630846713e-16
307// mean(f - f_Boost): 5.1070259132757197e-16
308// variance(f - f_Boost): 1.7591111235252501e-32
309// stddev(f - f_Boost): 1.3263148659067538e-16
2be75957
ESR
310const testcase_comp_ellint_3<double>
311data013[10] =
312{
b4688136
ESR
313 { 1.6080486199305128, 0.30000000000000004, 0.0000000000000000, 0.0 },
314 { 1.6960848815118228, 0.30000000000000004, 0.10000000000000001, 0.0 },
315 { 1.8002173372290500, 0.30000000000000004, 0.20000000000000001, 0.0 },
316 { 1.9260216862473254, 0.30000000000000004, 0.30000000000000004, 0.0 },
317 { 2.0822121773175533, 0.30000000000000004, 0.40000000000000002, 0.0 },
318 { 2.2833505881933975, 0.30000000000000004, 0.50000000000000000, 0.0 },
319 { 2.5560975528589065, 0.30000000000000004, 0.60000000000000009, 0.0 },
320 { 2.9562123549913877, 0.30000000000000004, 0.70000000000000007, 0.0 },
321 { 3.6283050484567174, 0.30000000000000004, 0.80000000000000004, 0.0 },
322 { 5.1479514944016795, 0.30000000000000004, 0.90000000000000002, 0.0 },
2be75957
ESR
323};
324const double toler013 = 2.5000000000000020e-13;
325
b4688136
ESR
326// Test data for k=0.40000000000000013.
327// max(|f - f_Boost|): 2.6645352591003757e-15 at index 9
328// max(|f - f_Boost| / |f_Boost|): 6.7696531428672557e-16
329// mean(f - f_Boost): 1.1990408665951691e-15
330// variance(f - f_Boost): 2.6514491536595121e-31
331// stddev(f - f_Boost): 5.1492224205791612e-16
2be75957
ESR
332const testcase_comp_ellint_3<double>
333data014[10] =
334{
b4688136
ESR
335 { 1.6399998658645112, 0.40000000000000013, 0.0000000000000000, 0.0 },
336 { 1.7306968836847190, 0.40000000000000013, 0.10000000000000001, 0.0 },
337 { 1.8380358826317629, 0.40000000000000013, 0.20000000000000001, 0.0 },
338 { 1.9677924132520141, 0.40000000000000013, 0.30000000000000004, 0.0 },
339 { 2.1289968719280030, 0.40000000000000013, 0.40000000000000002, 0.0 },
340 { 2.3367461373176512, 0.40000000000000013, 0.50000000000000000, 0.0 },
341 { 2.6186940209850196, 0.40000000000000013, 0.60000000000000009, 0.0 },
342 { 3.0327078743873246, 0.40000000000000013, 0.70000000000000007, 0.0 },
343 { 3.7289548002199906, 0.40000000000000013, 0.80000000000000004, 0.0 },
344 { 5.3055535102872522, 0.40000000000000013, 0.90000000000000002, 0.0 },
2be75957
ESR
345};
346const double toler014 = 2.5000000000000020e-13;
347
348// Test data for k=0.50000000000000000.
b4688136
ESR
349// max(|f - f_Boost|): 4.4408920985006262e-16 at index 3
350// max(|f - f_Boost| / |f_Boost|): 2.1900131385114407e-16
351// mean(f - f_Boost): 2.4424906541753446e-16
352// variance(f - f_Boost): 7.3651365379430888e-33
353// stddev(f - f_Boost): 8.5820373676319358e-17
2be75957
ESR
354const testcase_comp_ellint_3<double>
355data015[10] =
356{
b4688136
ESR
357 { 1.6857503548125961, 0.50000000000000000, 0.0000000000000000, 0.0 },
358 { 1.7803034946545482, 0.50000000000000000, 0.10000000000000001, 0.0 },
359 { 1.8922947612264021, 0.50000000000000000, 0.20000000000000001, 0.0 },
360 { 2.0277924458111314, 0.50000000000000000, 0.30000000000000004, 0.0 },
361 { 2.1962905366178065, 0.50000000000000000, 0.40000000000000002, 0.0 },
362 { 2.4136715042011945, 0.50000000000000000, 0.50000000000000000, 0.0 },
363 { 2.7090491861753558, 0.50000000000000000, 0.60000000000000009, 0.0 },
364 { 3.1433945297859229, 0.50000000000000000, 0.70000000000000007, 0.0 },
365 { 3.8750701888108070, 0.50000000000000000, 0.80000000000000004, 0.0 },
366 { 5.5355132096026463, 0.50000000000000000, 0.90000000000000002, 0.0 },
2be75957
ESR
367};
368const double toler015 = 2.5000000000000020e-13;
369
370// Test data for k=0.60000000000000009.
b4688136
ESR
371// max(|f - f_Boost|): 4.4408920985006262e-16 at index 2
372// max(|f - f_Boost| / |f_Boost|): 2.2547200163366559e-16
373// mean(f - f_Boost): -2.2204460492503131e-16
374// variance(f - f_Boost): 6.0868897007794117e-33
375// stddev(f - f_Boost): 7.8018521523926690e-17
2be75957
ESR
376const testcase_comp_ellint_3<double>
377data016[10] =
378{
b4688136
ESR
379 { 1.7507538029157526, 0.60000000000000009, 0.0000000000000000, 0.0 },
380 { 1.8508766487100687, 0.60000000000000009, 0.10000000000000001, 0.0 },
381 { 1.9695980282802217, 0.60000000000000009, 0.20000000000000001, 0.0 },
382 { 2.1134154405060599, 0.60000000000000009, 0.30000000000000004, 0.0 },
383 { 2.2925036420985130, 0.60000000000000009, 0.40000000000000002, 0.0 },
384 { 2.5239007084492711, 0.60000000000000009, 0.50000000000000000, 0.0 },
385 { 2.8388723099514976, 0.60000000000000009, 0.60000000000000009, 0.0 },
386 { 3.3029735898397159, 0.60000000000000009, 0.70000000000000007, 0.0 },
387 { 4.0867036409261832, 0.60000000000000009, 0.80000000000000004, 0.0 },
388 { 5.8709993116265613, 0.60000000000000009, 0.90000000000000002, 0.0 },
2be75957
ESR
389};
390const double toler016 = 2.5000000000000020e-13;
391
b4688136
ESR
392// Test data for k=0.70000000000000018.
393// max(|f - f_Boost|): 1.7763568394002505e-15 at index 9
394// max(|f - f_Boost| / |f_Boost|): 2.9298727220933567e-16
395// mean(f - f_Boost): 4.8849813083506892e-16
396// variance(f - f_Boost): 2.0476296953421943e-31
397// stddev(f - f_Boost): 4.5250742483877478e-16
2be75957
ESR
398const testcase_comp_ellint_3<double>
399data017[10] =
400{
b4688136
ESR
401 { 1.8456939983747238, 0.70000000000000018, 0.0000000000000000, 0.0 },
402 { 1.9541347343119566, 0.70000000000000018, 0.10000000000000001, 0.0 },
403 { 2.0829290325820207, 0.70000000000000018, 0.20000000000000001, 0.0 },
404 { 2.2392290510988540, 0.70000000000000018, 0.30000000000000004, 0.0 },
405 { 2.4342502915307880, 0.70000000000000018, 0.40000000000000002, 0.0 },
406 { 2.6868019968237000, 0.70000000000000018, 0.50000000000000000, 0.0 },
407 { 3.0314573496746746, 0.70000000000000018, 0.60000000000000009, 0.0 },
408 { 3.5408408771788569, 0.70000000000000018, 0.70000000000000007, 0.0 },
409 { 4.4042405729076970, 0.70000000000000018, 0.80000000000000004, 0.0 },
410 { 6.3796094177887763, 0.70000000000000018, 0.90000000000000002, 0.0 },
2be75957
ESR
411};
412const double toler017 = 2.5000000000000020e-13;
413
414// Test data for k=0.80000000000000004.
b4688136
ESR
415// max(|f - f_Boost|): 1.7763568394002505e-15 at index 8
416// max(|f - f_Boost| / |f_Boost|): 4.1949393471095187e-16
417// mean(f - f_Boost): 9.5479180117763459e-16
418// variance(f - f_Boost): 5.4782007307014711e-34
419// stddev(f - f_Boost): 2.3405556457178006e-17
2be75957
ESR
420const testcase_comp_ellint_3<double>
421data018[10] =
422{
b4688136
ESR
423 { 1.9953027776647294, 0.80000000000000004, 0.0000000000000000, 0.0 },
424 { 2.1172616484005085, 0.80000000000000004, 0.10000000000000001, 0.0 },
425 { 2.2624789434186798, 0.80000000000000004, 0.20000000000000001, 0.0 },
426 { 2.4392042002725698, 0.80000000000000004, 0.30000000000000004, 0.0 },
427 { 2.6604037035529728, 0.80000000000000004, 0.40000000000000002, 0.0 },
428 { 2.9478781158239751, 0.80000000000000004, 0.50000000000000000, 0.0 },
429 { 3.3418121892288055, 0.80000000000000004, 0.60000000000000009, 0.0 },
430 { 3.9268876980046397, 0.80000000000000004, 0.70000000000000007, 0.0 },
431 { 4.9246422058196071, 0.80000000000000004, 0.80000000000000004, 0.0 },
432 { 7.2263259298637132, 0.80000000000000004, 0.90000000000000002, 0.0 },
2be75957
ESR
433};
434const double toler018 = 2.5000000000000020e-13;
435
b4688136
ESR
436// Test data for k=0.90000000000000013.
437// max(|f - f_Boost|): 4.4408920985006262e-16 at index 3
438// max(|f - f_Boost| / |f_Boost|): 1.5716352001310461e-16
439// mean(f - f_Boost): 4.4408920985006264e-17
440// variance(f - f_Boost): 2.4347558803117648e-34
441// stddev(f - f_Boost): 1.5603704304785339e-17
2be75957
ESR
442const testcase_comp_ellint_3<double>
443data019[10] =
444{
b4688136
ESR
445 { 2.2805491384227707, 0.90000000000000013, 0.0000000000000000, 0.0 },
446 { 2.4295011187834890, 0.90000000000000013, 0.10000000000000001, 0.0 },
447 { 2.6076835743348421, 0.90000000000000013, 0.20000000000000001, 0.0 },
448 { 2.8256506968858521, 0.90000000000000013, 0.30000000000000004, 0.0 },
449 { 3.1000689868578628, 0.90000000000000013, 0.40000000000000002, 0.0 },
450 { 3.4591069002104686, 0.90000000000000013, 0.50000000000000000, 0.0 },
451 { 3.9549939883570242, 0.90000000000000013, 0.60000000000000009, 0.0 },
452 { 4.6985482312992453, 0.90000000000000013, 0.70000000000000007, 0.0 },
453 { 5.9820740813645727, 0.90000000000000013, 0.80000000000000004, 0.0 },
454 { 8.9942562031858735, 0.90000000000000013, 0.90000000000000002, 0.0 },
2be75957
ESR
455};
456const double toler019 = 2.5000000000000020e-13;
457
b4688136 458template<typename Ret, unsigned int Num>
2be75957 459 void
b4688136 460 test(const testcase_comp_ellint_3<Ret> (&data)[Num], Ret toler)
2be75957 461 {
b4688136
ESR
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);
2be75957
ESR
466 unsigned int num_datum = Num;
467 for (unsigned int i = 0; i < num_datum; ++i)
468 {
b4688136
ESR
469 const Ret f = std::comp_ellint_3(data[i].k, data[i].nu);
470 const Ret f0 = data[i].f0;
471 const Ret diff = f - f0;
2be75957
ESR
472 if (std::abs(diff) > max_abs_diff)
473 max_abs_diff = std::abs(diff);
b4688136
ESR
474 if (std::abs(f0) > Ret(10) * eps
475 && std::abs(f) > Ret(10) * eps)
2be75957 476 {
b4688136 477 const Ret frac = diff / f0;
2be75957
ESR
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
485int
486main()
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}