]>
Commit | Line | Data |
---|---|---|
2be75957 ESR |
1 | // { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" } |
2 | // | |
3 | // Copyright (C) 2016 Free Software Foundation, Inc. | |
4 | // | |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
8 | // Free Software Foundation; either version 3, or (at your option) | |
9 | // any later version. | |
10 | // | |
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | // | |
16 | // You should have received a copy of the GNU General Public License along | |
17 | // with this library; see the file COPYING3. If not see | |
18 | // <http://www.gnu.org/licenses/>. | |
19 | ||
20 | // comp_ellint_3 | |
21 | // Compare against values generated by the GNU Scientific Library. | |
22 | // The GSL can be found on the web: http://www.gnu.org/software/gsl/ | |
23 | #include <limits> | |
24 | #include <cmath> | |
25 | #if defined(__TEST_DEBUG) | |
26 | # include <iostream> | |
27 | # define VERIFY(A) \ | |
28 | if (!(A)) \ | |
29 | { \ | |
30 | std::cout << "line " << __LINE__ \ | |
31 | << " max_abs_frac = " << max_abs_frac \ | |
32 | << std::endl; \ | |
33 | } | |
34 | #else | |
35 | # include <testsuite_hooks.h> | |
36 | #endif | |
37 | #include <specfun_testcase.h> | |
38 | ||
39 | ||
40 | // Test data for k=-0.90000000000000002. | |
41 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
42 | // max(|f - f_GSL| / |f_GSL|): 2.6751587294384150e-16 | |
43 | const testcase_comp_ellint_3<double> | |
44 | data001[10] = | |
45 | { | |
46 | { 2.2805491384227703, -0.90000000000000002, 0.0000000000000000 }, | |
47 | { 2.1537868513875287, -0.90000000000000002, 0.10000000000000001 }, | |
48 | { 2.0443194576468890, -0.90000000000000002, 0.20000000000000001 }, | |
49 | { 1.9486280260314426, -0.90000000000000002, 0.29999999999999999 }, | |
50 | { 1.8641114227238349, -0.90000000000000002, 0.40000000000000002 }, | |
51 | { 1.7888013241937861, -0.90000000000000002, 0.50000000000000000 }, | |
52 | { 1.7211781128919523, -0.90000000000000002, 0.59999999999999998 }, | |
53 | { 1.6600480747670940, -0.90000000000000002, 0.69999999999999996 }, | |
54 | { 1.6044591960982202, -0.90000000000000002, 0.80000000000000004 }, | |
55 | { 1.5536420236310946, -0.90000000000000002, 0.90000000000000002 }, | |
56 | }; | |
57 | const double toler001 = 2.5000000000000020e-13; | |
58 | ||
59 | // Test data for k=-0.80000000000000004. | |
60 | // max(|f - f_GSL|): 2.2204460492503131e-16 | |
61 | // max(|f - f_GSL| / |f_GSL|): 1.5960830388244336e-16 | |
62 | const testcase_comp_ellint_3<double> | |
63 | data002[10] = | |
64 | { | |
65 | { 1.9953027776647296, -0.80000000000000004, 0.0000000000000000 }, | |
66 | { 1.8910755418379521, -0.80000000000000004, 0.10000000000000001 }, | |
67 | { 1.8007226661734588, -0.80000000000000004, 0.20000000000000001 }, | |
68 | { 1.7214611048717301, -0.80000000000000004, 0.29999999999999999 }, | |
69 | { 1.6512267838651289, -0.80000000000000004, 0.40000000000000002 }, | |
70 | { 1.5884528947755532, -0.80000000000000004, 0.50000000000000000 }, | |
71 | { 1.5319262547427865, -0.80000000000000004, 0.59999999999999998 }, | |
72 | { 1.4806912324625332, -0.80000000000000004, 0.69999999999999996 }, | |
73 | { 1.4339837018309471, -0.80000000000000004, 0.80000000000000004 }, | |
74 | { 1.3911845406776222, -0.80000000000000004, 0.90000000000000002 }, | |
75 | }; | |
76 | const double toler002 = 2.5000000000000020e-13; | |
77 | ||
78 | // Test data for k=-0.69999999999999996. | |
79 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
80 | // max(|f - f_GSL| / |f_GSL|): 3.3074070916136724e-16 | |
81 | const testcase_comp_ellint_3<double> | |
82 | data003[10] = | |
83 | { | |
84 | { 1.8456939983747236, -0.69999999999999996, 0.0000000000000000 }, | |
85 | { 1.7528050171757608, -0.69999999999999996, 0.10000000000000001 }, | |
86 | { 1.6721098780092145, -0.69999999999999996, 0.20000000000000001 }, | |
87 | { 1.6011813647733213, -0.69999999999999996, 0.29999999999999999 }, | |
88 | { 1.5382162002954762, -0.69999999999999996, 0.40000000000000002 }, | |
89 | { 1.4818433192178544, -0.69999999999999996, 0.50000000000000000 }, | |
90 | { 1.4309994736080540, -0.69999999999999996, 0.59999999999999998 }, | |
91 | { 1.3848459188329196, -0.69999999999999996, 0.69999999999999996 }, | |
92 | { 1.3427110650397531, -0.69999999999999996, 0.80000000000000004 }, | |
93 | { 1.3040500499695913, -0.69999999999999996, 0.90000000000000002 }, | |
94 | }; | |
95 | const double toler003 = 2.5000000000000020e-13; | |
96 | ||
97 | // Test data for k=-0.59999999999999998. | |
98 | // max(|f - f_GSL|): 6.6613381477509392e-16 | |
99 | // max(|f - f_GSL| / |f_GSL|): 4.1891472451898755e-16 | |
100 | const testcase_comp_ellint_3<double> | |
101 | data004[10] = | |
102 | { | |
103 | { 1.7507538029157526, -0.59999999999999998, 0.0000000000000000 }, | |
104 | { 1.6648615773343014, -0.59999999999999998, 0.10000000000000001 }, | |
105 | { 1.5901418016279374, -0.59999999999999998, 0.20000000000000001 }, | |
106 | { 1.5243814243493585, -0.59999999999999998, 0.29999999999999999 }, | |
107 | { 1.4659345278069984, -0.59999999999999998, 0.40000000000000002 }, | |
108 | { 1.4135484285693078, -0.59999999999999998, 0.50000000000000000 }, | |
109 | { 1.3662507535812816, -0.59999999999999998, 0.59999999999999998 }, | |
110 | { 1.3232737468822813, -0.59999999999999998, 0.69999999999999996 }, | |
111 | { 1.2840021261752192, -0.59999999999999998, 0.80000000000000004 }, | |
112 | { 1.2479362973851875, -0.59999999999999998, 0.90000000000000002 }, | |
113 | }; | |
114 | const double toler004 = 2.5000000000000020e-13; | |
115 | ||
116 | // Test data for k=-0.50000000000000000. | |
117 | // max(|f - f_GSL|): 2.2204460492503131e-16 | |
118 | // max(|f - f_GSL| / |f_GSL|): 1.7857620325589816e-16 | |
119 | const testcase_comp_ellint_3<double> | |
120 | data005[10] = | |
121 | { | |
122 | { 1.6857503548125963, -0.50000000000000000, 0.0000000000000000 }, | |
123 | { 1.6045524936084892, -0.50000000000000000, 0.10000000000000001 }, | |
124 | { 1.5338490483665983, -0.50000000000000000, 0.20000000000000001 }, | |
125 | { 1.4715681939859637, -0.50000000000000000, 0.29999999999999999 }, | |
126 | { 1.4161679518465340, -0.50000000000000000, 0.40000000000000002 }, | |
127 | { 1.3664739530045971, -0.50000000000000000, 0.50000000000000000 }, | |
128 | { 1.3215740290190876, -0.50000000000000000, 0.59999999999999998 }, | |
129 | { 1.2807475181182502, -0.50000000000000000, 0.69999999999999996 }, | |
130 | { 1.2434165408189539, -0.50000000000000000, 0.80000000000000004 }, | |
131 | { 1.2091116095504744, -0.50000000000000000, 0.90000000000000002 }, | |
132 | }; | |
133 | const double toler005 = 2.5000000000000020e-13; | |
134 | ||
135 | // Test data for k=-0.40000000000000002. | |
136 | // max(|f - f_GSL|): 8.8817841970012523e-16 | |
137 | // max(|f - f_GSL| / |f_GSL|): 6.1925080711125793e-16 | |
138 | const testcase_comp_ellint_3<double> | |
139 | data006[10] = | |
140 | { | |
141 | { 1.6399998658645112, -0.40000000000000002, 0.0000000000000000 }, | |
142 | { 1.5620566886683604, -0.40000000000000002, 0.10000000000000001 }, | |
143 | { 1.4941414344266770, -0.40000000000000002, 0.20000000000000001 }, | |
144 | { 1.4342789859950078, -0.40000000000000002, 0.29999999999999999 }, | |
145 | { 1.3809986210732901, -0.40000000000000002, 0.40000000000000002 }, | |
146 | { 1.3331797176377398, -0.40000000000000002, 0.50000000000000000 }, | |
147 | { 1.2899514672527024, -0.40000000000000002, 0.59999999999999998 }, | |
148 | { 1.2506255923253344, -0.40000000000000002, 0.69999999999999996 }, | |
149 | { 1.2146499565727209, -0.40000000000000002, 0.80000000000000004 }, | |
150 | { 1.1815758115929846, -0.40000000000000002, 0.90000000000000002 }, | |
151 | }; | |
152 | const double toler006 = 2.5000000000000020e-13; | |
153 | ||
154 | // Test data for k=-0.30000000000000004. | |
155 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
156 | // max(|f - f_GSL| / |f_GSL|): 3.8209844149902043e-16 | |
157 | const testcase_comp_ellint_3<double> | |
158 | data007[10] = | |
159 | { | |
160 | { 1.6080486199305128, -0.30000000000000004, 0.0000000000000000 }, | |
161 | { 1.5323534693557528, -0.30000000000000004, 0.10000000000000001 }, | |
162 | { 1.4663658145259877, -0.30000000000000004, 0.20000000000000001 }, | |
163 | { 1.4081767433479091, -0.30000000000000004, 0.29999999999999999 }, | |
164 | { 1.3563643538969763, -0.30000000000000004, 0.40000000000000002 }, | |
165 | { 1.3098448759814962, -0.30000000000000004, 0.50000000000000000 }, | |
166 | { 1.2677758800420669, -0.30000000000000004, 0.59999999999999998 }, | |
167 | { 1.2294913236274982, -0.30000000000000004, 0.69999999999999996 }, | |
168 | { 1.1944567571590048, -0.30000000000000004, 0.80000000000000004 }, | |
169 | { 1.1622376896064914, -0.30000000000000004, 0.90000000000000002 }, | |
170 | }; | |
171 | const double toler007 = 2.5000000000000020e-13; | |
172 | ||
173 | // Test data for k=-0.19999999999999996. | |
174 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
175 | // max(|f - f_GSL| / |f_GSL|): 3.8637687241174905e-16 | |
176 | const testcase_comp_ellint_3<double> | |
177 | data008[10] = | |
178 | { | |
179 | { 1.5868678474541660, -0.19999999999999996, 0.0000000000000000 }, | |
180 | { 1.5126513474261087, -0.19999999999999996, 0.10000000000000001 }, | |
181 | { 1.4479323932249564, -0.19999999999999996, 0.20000000000000001 }, | |
182 | { 1.3908453514752477, -0.19999999999999996, 0.29999999999999999 }, | |
183 | { 1.3400002519661005, -0.19999999999999996, 0.40000000000000002 }, | |
184 | { 1.2943374404397372, -0.19999999999999996, 0.50000000000000000 }, | |
185 | { 1.2530330675914556, -0.19999999999999996, 0.59999999999999998 }, | |
186 | { 1.2154356555075863, -0.19999999999999996, 0.69999999999999996 }, | |
187 | { 1.1810223448909909, -0.19999999999999996, 0.80000000000000004 }, | |
188 | { 1.1493679916141861, -0.19999999999999996, 0.90000000000000002 }, | |
189 | }; | |
190 | const double toler008 = 2.5000000000000020e-13; | |
191 | ||
192 | // Test data for k=-0.099999999999999978. | |
193 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
194 | // max(|f - f_GSL| / |f_GSL|): 3.8887517676790089e-16 | |
195 | const testcase_comp_ellint_3<double> | |
196 | data009[10] = | |
197 | { | |
198 | { 1.5747455615173562, -0.099999999999999978, 0.0000000000000000 }, | |
199 | { 1.5013711111199950, -0.099999999999999978, 0.10000000000000001 }, | |
200 | { 1.4373749386463430, -0.099999999999999978, 0.20000000000000001 }, | |
201 | { 1.3809159606704959, -0.099999999999999978, 0.29999999999999999 }, | |
202 | { 1.3306223265207477, -0.099999999999999978, 0.40000000000000002 }, | |
203 | { 1.2854480708580160, -0.099999999999999978, 0.50000000000000000 }, | |
204 | { 1.2445798942989255, -0.099999999999999978, 0.59999999999999998 }, | |
205 | { 1.2073745911083185, -0.099999999999999978, 0.69999999999999996 }, | |
206 | { 1.1733158866987732, -0.099999999999999978, 0.80000000000000004 }, | |
207 | { 1.1419839485283374, -0.099999999999999978, 0.90000000000000002 }, | |
208 | }; | |
209 | const double toler009 = 2.5000000000000020e-13; | |
210 | ||
211 | // Test data for k=0.0000000000000000. | |
212 | // max(|f - f_GSL|): 2.2204460492503131e-16 | |
213 | // max(|f - f_GSL| / |f_GSL|): 1.6725702444488137e-16 | |
214 | const testcase_comp_ellint_3<double> | |
215 | data010[10] = | |
216 | { | |
217 | { 1.5707963267948966, 0.0000000000000000, 0.0000000000000000 }, | |
218 | { 1.4976955329233277, 0.0000000000000000, 0.10000000000000001 }, | |
219 | { 1.4339343023863691, 0.0000000000000000, 0.20000000000000001 }, | |
220 | { 1.3776795151134889, 0.0000000000000000, 0.29999999999999999 }, | |
221 | { 1.3275651989026320, 0.0000000000000000, 0.40000000000000002 }, | |
222 | { 1.2825498301618641, 0.0000000000000000, 0.50000000000000000 }, | |
223 | { 1.2418235332245127, 0.0000000000000000, 0.59999999999999998 }, | |
224 | { 1.2047457872617382, 0.0000000000000000, 0.69999999999999996 }, | |
225 | { 1.1708024551734544, 0.0000000000000000, 0.80000000000000004 }, | |
226 | { 1.1395754288497419, 0.0000000000000000, 0.90000000000000002 }, | |
227 | }; | |
228 | const double toler010 = 2.5000000000000020e-13; | |
229 | ||
230 | // Test data for k=0.10000000000000009. | |
231 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
232 | // max(|f - f_GSL| / |f_GSL|): 3.8887517676790089e-16 | |
233 | const testcase_comp_ellint_3<double> | |
234 | data011[10] = | |
235 | { | |
236 | { 1.5747455615173562, 0.10000000000000009, 0.0000000000000000 }, | |
237 | { 1.5013711111199950, 0.10000000000000009, 0.10000000000000001 }, | |
238 | { 1.4373749386463430, 0.10000000000000009, 0.20000000000000001 }, | |
239 | { 1.3809159606704959, 0.10000000000000009, 0.29999999999999999 }, | |
240 | { 1.3306223265207477, 0.10000000000000009, 0.40000000000000002 }, | |
241 | { 1.2854480708580160, 0.10000000000000009, 0.50000000000000000 }, | |
242 | { 1.2445798942989255, 0.10000000000000009, 0.59999999999999998 }, | |
243 | { 1.2073745911083185, 0.10000000000000009, 0.69999999999999996 }, | |
244 | { 1.1733158866987732, 0.10000000000000009, 0.80000000000000004 }, | |
245 | { 1.1419839485283374, 0.10000000000000009, 0.90000000000000002 }, | |
246 | }; | |
247 | const double toler011 = 2.5000000000000020e-13; | |
248 | ||
249 | // Test data for k=0.19999999999999996. | |
250 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
251 | // max(|f - f_GSL| / |f_GSL|): 3.8637687241174905e-16 | |
252 | const testcase_comp_ellint_3<double> | |
253 | data012[10] = | |
254 | { | |
255 | { 1.5868678474541660, 0.19999999999999996, 0.0000000000000000 }, | |
256 | { 1.5126513474261087, 0.19999999999999996, 0.10000000000000001 }, | |
257 | { 1.4479323932249564, 0.19999999999999996, 0.20000000000000001 }, | |
258 | { 1.3908453514752477, 0.19999999999999996, 0.29999999999999999 }, | |
259 | { 1.3400002519661005, 0.19999999999999996, 0.40000000000000002 }, | |
260 | { 1.2943374404397372, 0.19999999999999996, 0.50000000000000000 }, | |
261 | { 1.2530330675914556, 0.19999999999999996, 0.59999999999999998 }, | |
262 | { 1.2154356555075863, 0.19999999999999996, 0.69999999999999996 }, | |
263 | { 1.1810223448909909, 0.19999999999999996, 0.80000000000000004 }, | |
264 | { 1.1493679916141861, 0.19999999999999996, 0.90000000000000002 }, | |
265 | }; | |
266 | const double toler012 = 2.5000000000000020e-13; | |
267 | ||
268 | // Test data for k=0.30000000000000004. | |
269 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
270 | // max(|f - f_GSL| / |f_GSL|): 3.8209844149902043e-16 | |
271 | const testcase_comp_ellint_3<double> | |
272 | data013[10] = | |
273 | { | |
274 | { 1.6080486199305128, 0.30000000000000004, 0.0000000000000000 }, | |
275 | { 1.5323534693557528, 0.30000000000000004, 0.10000000000000001 }, | |
276 | { 1.4663658145259877, 0.30000000000000004, 0.20000000000000001 }, | |
277 | { 1.4081767433479091, 0.30000000000000004, 0.29999999999999999 }, | |
278 | { 1.3563643538969763, 0.30000000000000004, 0.40000000000000002 }, | |
279 | { 1.3098448759814962, 0.30000000000000004, 0.50000000000000000 }, | |
280 | { 1.2677758800420669, 0.30000000000000004, 0.59999999999999998 }, | |
281 | { 1.2294913236274982, 0.30000000000000004, 0.69999999999999996 }, | |
282 | { 1.1944567571590048, 0.30000000000000004, 0.80000000000000004 }, | |
283 | { 1.1622376896064914, 0.30000000000000004, 0.90000000000000002 }, | |
284 | }; | |
285 | const double toler013 = 2.5000000000000020e-13; | |
286 | ||
287 | // Test data for k=0.39999999999999991. | |
288 | // max(|f - f_GSL|): 8.8817841970012523e-16 | |
289 | // max(|f - f_GSL| / |f_GSL|): 6.1925080711125793e-16 | |
290 | const testcase_comp_ellint_3<double> | |
291 | data014[10] = | |
292 | { | |
293 | { 1.6399998658645112, 0.39999999999999991, 0.0000000000000000 }, | |
294 | { 1.5620566886683604, 0.39999999999999991, 0.10000000000000001 }, | |
295 | { 1.4941414344266770, 0.39999999999999991, 0.20000000000000001 }, | |
296 | { 1.4342789859950078, 0.39999999999999991, 0.29999999999999999 }, | |
297 | { 1.3809986210732901, 0.39999999999999991, 0.40000000000000002 }, | |
298 | { 1.3331797176377398, 0.39999999999999991, 0.50000000000000000 }, | |
299 | { 1.2899514672527024, 0.39999999999999991, 0.59999999999999998 }, | |
300 | { 1.2506255923253344, 0.39999999999999991, 0.69999999999999996 }, | |
301 | { 1.2146499565727209, 0.39999999999999991, 0.80000000000000004 }, | |
302 | { 1.1815758115929846, 0.39999999999999991, 0.90000000000000002 }, | |
303 | }; | |
304 | const double toler014 = 2.5000000000000020e-13; | |
305 | ||
306 | // Test data for k=0.50000000000000000. | |
307 | // max(|f - f_GSL|): 2.2204460492503131e-16 | |
308 | // max(|f - f_GSL| / |f_GSL|): 1.7857620325589816e-16 | |
309 | const testcase_comp_ellint_3<double> | |
310 | data015[10] = | |
311 | { | |
312 | { 1.6857503548125963, 0.50000000000000000, 0.0000000000000000 }, | |
313 | { 1.6045524936084892, 0.50000000000000000, 0.10000000000000001 }, | |
314 | { 1.5338490483665983, 0.50000000000000000, 0.20000000000000001 }, | |
315 | { 1.4715681939859637, 0.50000000000000000, 0.29999999999999999 }, | |
316 | { 1.4161679518465340, 0.50000000000000000, 0.40000000000000002 }, | |
317 | { 1.3664739530045971, 0.50000000000000000, 0.50000000000000000 }, | |
318 | { 1.3215740290190876, 0.50000000000000000, 0.59999999999999998 }, | |
319 | { 1.2807475181182502, 0.50000000000000000, 0.69999999999999996 }, | |
320 | { 1.2434165408189539, 0.50000000000000000, 0.80000000000000004 }, | |
321 | { 1.2091116095504744, 0.50000000000000000, 0.90000000000000002 }, | |
322 | }; | |
323 | const double toler015 = 2.5000000000000020e-13; | |
324 | ||
325 | // Test data for k=0.60000000000000009. | |
326 | // max(|f - f_GSL|): 6.6613381477509392e-16 | |
327 | // max(|f - f_GSL| / |f_GSL|): 4.7124937590522226e-16 | |
328 | const testcase_comp_ellint_3<double> | |
329 | data016[10] = | |
330 | { | |
331 | { 1.7507538029157526, 0.60000000000000009, 0.0000000000000000 }, | |
332 | { 1.6648615773343014, 0.60000000000000009, 0.10000000000000001 }, | |
333 | { 1.5901418016279374, 0.60000000000000009, 0.20000000000000001 }, | |
334 | { 1.5243814243493585, 0.60000000000000009, 0.29999999999999999 }, | |
335 | { 1.4659345278069984, 0.60000000000000009, 0.40000000000000002 }, | |
336 | { 1.4135484285693078, 0.60000000000000009, 0.50000000000000000 }, | |
337 | { 1.3662507535812816, 0.60000000000000009, 0.59999999999999998 }, | |
338 | { 1.3232737468822813, 0.60000000000000009, 0.69999999999999996 }, | |
339 | { 1.2840021261752192, 0.60000000000000009, 0.80000000000000004 }, | |
340 | { 1.2479362973851873, 0.60000000000000009, 0.90000000000000002 }, | |
341 | }; | |
342 | const double toler016 = 2.5000000000000020e-13; | |
343 | ||
344 | // Test data for k=0.69999999999999996. | |
345 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
346 | // max(|f - f_GSL| / |f_GSL|): 3.3074070916136724e-16 | |
347 | const testcase_comp_ellint_3<double> | |
348 | data017[10] = | |
349 | { | |
350 | { 1.8456939983747236, 0.69999999999999996, 0.0000000000000000 }, | |
351 | { 1.7528050171757608, 0.69999999999999996, 0.10000000000000001 }, | |
352 | { 1.6721098780092145, 0.69999999999999996, 0.20000000000000001 }, | |
353 | { 1.6011813647733213, 0.69999999999999996, 0.29999999999999999 }, | |
354 | { 1.5382162002954762, 0.69999999999999996, 0.40000000000000002 }, | |
355 | { 1.4818433192178544, 0.69999999999999996, 0.50000000000000000 }, | |
356 | { 1.4309994736080540, 0.69999999999999996, 0.59999999999999998 }, | |
357 | { 1.3848459188329196, 0.69999999999999996, 0.69999999999999996 }, | |
358 | { 1.3427110650397531, 0.69999999999999996, 0.80000000000000004 }, | |
359 | { 1.3040500499695913, 0.69999999999999996, 0.90000000000000002 }, | |
360 | }; | |
361 | const double toler017 = 2.5000000000000020e-13; | |
362 | ||
363 | // Test data for k=0.80000000000000004. | |
364 | // max(|f - f_GSL|): 2.2204460492503131e-16 | |
365 | // max(|f - f_GSL| / |f_GSL|): 1.5960830388244336e-16 | |
366 | const testcase_comp_ellint_3<double> | |
367 | data018[10] = | |
368 | { | |
369 | { 1.9953027776647296, 0.80000000000000004, 0.0000000000000000 }, | |
370 | { 1.8910755418379521, 0.80000000000000004, 0.10000000000000001 }, | |
371 | { 1.8007226661734588, 0.80000000000000004, 0.20000000000000001 }, | |
372 | { 1.7214611048717301, 0.80000000000000004, 0.29999999999999999 }, | |
373 | { 1.6512267838651289, 0.80000000000000004, 0.40000000000000002 }, | |
374 | { 1.5884528947755532, 0.80000000000000004, 0.50000000000000000 }, | |
375 | { 1.5319262547427865, 0.80000000000000004, 0.59999999999999998 }, | |
376 | { 1.4806912324625332, 0.80000000000000004, 0.69999999999999996 }, | |
377 | { 1.4339837018309471, 0.80000000000000004, 0.80000000000000004 }, | |
378 | { 1.3911845406776222, 0.80000000000000004, 0.90000000000000002 }, | |
379 | }; | |
380 | const double toler018 = 2.5000000000000020e-13; | |
381 | ||
382 | // Test data for k=0.89999999999999991. | |
383 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
384 | // max(|f - f_GSL| / |f_GSL|): 2.6751587294384150e-16 | |
385 | const testcase_comp_ellint_3<double> | |
386 | data019[10] = | |
387 | { | |
388 | { 2.2805491384227703, 0.89999999999999991, 0.0000000000000000 }, | |
389 | { 2.1537868513875287, 0.89999999999999991, 0.10000000000000001 }, | |
390 | { 2.0443194576468895, 0.89999999999999991, 0.20000000000000001 }, | |
391 | { 1.9486280260314426, 0.89999999999999991, 0.29999999999999999 }, | |
392 | { 1.8641114227238351, 0.89999999999999991, 0.40000000000000002 }, | |
393 | { 1.7888013241937863, 0.89999999999999991, 0.50000000000000000 }, | |
394 | { 1.7211781128919525, 0.89999999999999991, 0.59999999999999998 }, | |
395 | { 1.6600480747670940, 0.89999999999999991, 0.69999999999999996 }, | |
396 | { 1.6044591960982202, 0.89999999999999991, 0.80000000000000004 }, | |
397 | { 1.5536420236310948, 0.89999999999999991, 0.90000000000000002 }, | |
398 | }; | |
399 | const double toler019 = 2.5000000000000020e-13; | |
400 | ||
401 | template<typename Tp, unsigned int Num> | |
402 | void | |
403 | test(const testcase_comp_ellint_3<Tp> (&data)[Num], Tp toler) | |
404 | { | |
405 | bool test __attribute__((unused)) = true; | |
406 | const Tp eps = std::numeric_limits<Tp>::epsilon(); | |
407 | Tp max_abs_diff = -Tp(1); | |
408 | Tp max_abs_frac = -Tp(1); | |
409 | unsigned int num_datum = Num; | |
410 | for (unsigned int i = 0; i < num_datum; ++i) | |
411 | { | |
412 | const Tp f = std::comp_ellint_3(data[i].k, data[i].nu); | |
413 | const Tp f0 = data[i].f0; | |
414 | const Tp diff = f - f0; | |
415 | if (std::abs(diff) > max_abs_diff) | |
416 | max_abs_diff = std::abs(diff); | |
417 | if (std::abs(f0) > Tp(10) * eps | |
418 | && std::abs(f) > Tp(10) * eps) | |
419 | { | |
420 | const Tp frac = diff / f0; | |
421 | if (std::abs(frac) > max_abs_frac) | |
422 | max_abs_frac = std::abs(frac); | |
423 | } | |
424 | } | |
425 | VERIFY(max_abs_frac < toler); | |
426 | } | |
427 | ||
428 | int | |
429 | main() | |
430 | { | |
431 | test(data001, toler001); | |
432 | test(data002, toler002); | |
433 | test(data003, toler003); | |
434 | test(data004, toler004); | |
435 | test(data005, toler005); | |
436 | test(data006, toler006); | |
437 | test(data007, toler007); | |
438 | test(data008, toler008); | |
439 | test(data009, toler009); | |
440 | test(data010, toler010); | |
441 | test(data011, toler011); | |
442 | test(data012, toler012); | |
443 | test(data013, toler013); | |
444 | test(data014, toler014); | |
445 | test(data015, toler015); | |
446 | test(data016, toler016); | |
447 | test(data017, toler017); | |
448 | test(data018, toler018); | |
449 | test(data019, toler019); | |
450 | return 0; | |
451 | } |