]>
Commit | Line | Data |
---|---|---|
196c9e7a | 1 | // { dg-do run { target c++11 } } |
2be75957 ESR |
2 | // { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" } |
3 | // | |
4 | // Copyright (C) 2016 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 | ||
41 | // Test data for k=-0.90000000000000002. | |
42 | // max(|f - f_GSL|): 6.6613381477509392e-16 | |
43 | // max(|f - f_GSL| / |f_GSL|): 6.6116483711056737e-16 | |
44 | const testcase_ellint_2<double> | |
45 | data001[10] = | |
46 | { | |
47 | { 0.0000000000000000, -0.90000000000000002, 0.0000000000000000 }, | |
48 | { 0.17381690606167960, -0.90000000000000002, 0.17453292519943295 }, | |
49 | { 0.34337919186972055, -0.90000000000000002, 0.34906585039886590 }, | |
50 | { 0.50464268659856326, -0.90000000000000002, 0.52359877559829882 }, | |
51 | { 0.65400003842368570, -0.90000000000000002, 0.69813170079773179 }, | |
52 | { 0.78854928419904646, -0.90000000000000002, 0.87266462599716477 }, | |
53 | { 0.90645698626315396, -0.90000000000000002, 1.0471975511965976 }, | |
54 | { 1.0075154899135925, -0.90000000000000002, 1.2217304763960306 }, | |
55 | { 1.0940135583194068, -0.90000000000000002, 1.3962634015954636 }, | |
56 | { 1.1716970527816140, -0.90000000000000002, 1.5707963267948966 }, | |
57 | }; | |
58 | const double toler001 = 2.5000000000000020e-13; | |
59 | ||
60 | // Test data for k=-0.80000000000000004. | |
61 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
62 | // max(|f - f_GSL| / |f_GSL|): 3.4793687438660849e-16 | |
63 | const testcase_ellint_2<double> | |
64 | data002[10] = | |
65 | { | |
66 | { 0.0000000000000000, -0.80000000000000004, 0.0000000000000000 }, | |
67 | { 0.17396762274534805, -0.80000000000000004, 0.17453292519943295 }, | |
68 | { 0.34458685226969316, -0.80000000000000004, 0.34906585039886590 }, | |
69 | { 0.50872923654502433, -0.80000000000000004, 0.52359877559829882 }, | |
70 | { 0.66372016539176215, -0.80000000000000004, 0.69813170079773179 }, | |
71 | { 0.80760344410167406, -0.80000000000000004, 0.87266462599716477 }, | |
72 | { 0.93945480372495049, -0.80000000000000004, 1.0471975511965976 }, | |
73 | { 1.0597473310395036, -0.80000000000000004, 1.2217304763960306 }, | |
74 | { 1.1706981862452361, -0.80000000000000004, 1.3962634015954636 }, | |
75 | { 1.2763499431699064, -0.80000000000000004, 1.5707963267948966 }, | |
76 | }; | |
77 | const double toler002 = 2.5000000000000020e-13; | |
78 | ||
79 | // Test data for k=-0.69999999999999996. | |
80 | // max(|f - f_GSL|): 3.3306690738754696e-16 | |
81 | // max(|f - f_GSL| / |f_GSL|): 4.0435005012914979e-16 | |
82 | const testcase_ellint_2<double> | |
83 | data003[10] = | |
84 | { | |
85 | { 0.0000000000000000, -0.69999999999999996, 0.0000000000000000 }, | |
86 | { 0.17410041242702542, -0.69999999999999996, 0.17453292519943295 }, | |
87 | { 0.34564605085764760, -0.69999999999999996, 0.34906585039886590 }, | |
88 | { 0.51228495693314646, -0.69999999999999996, 0.52359877559829882 }, | |
89 | { 0.67207654098799530, -0.69999999999999996, 0.69813170079773179 }, | |
90 | { 0.82370932631556515, -0.69999999999999996, 0.87266462599716477 }, | |
91 | { 0.96672313309452795, -0.69999999999999996, 1.0471975511965976 }, | |
92 | { 1.1017090644949503, -0.69999999999999996, 1.2217304763960306 }, | |
93 | { 1.2304180097292914, -0.69999999999999996, 1.3962634015954636 }, | |
94 | { 1.3556611355719554, -0.69999999999999996, 1.5707963267948966 }, | |
95 | }; | |
96 | const double toler003 = 2.5000000000000020e-13; | |
97 | ||
98 | // Test data for k=-0.59999999999999998. | |
99 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
100 | // max(|f - f_GSL| / |f_GSL|): 3.9101039108874066e-16 | |
101 | const testcase_ellint_2<double> | |
102 | data004[10] = | |
103 | { | |
104 | { 0.0000000000000000, -0.59999999999999998, 0.0000000000000000 }, | |
105 | { 0.17421534919599127, -0.59999999999999998, 0.17453292519943295 }, | |
106 | { 0.34655927787174101, -0.59999999999999998, 0.34906585039886590 }, | |
107 | { 0.51533034538432143, -0.59999999999999998, 0.52359877559829882 }, | |
108 | { 0.67916550597453018, -0.59999999999999998, 0.69813170079773179 }, | |
109 | { 0.83720218180349870, -0.59999999999999998, 0.87266462599716477 }, | |
110 | { 0.98922159354937755, -0.59999999999999998, 1.0471975511965976 }, | |
111 | { 1.1357478470419360, -0.59999999999999998, 1.2217304763960306 }, | |
112 | { 1.2780617372844056, -0.59999999999999998, 1.3962634015954636 }, | |
113 | { 1.4180833944487241, -0.59999999999999998, 1.5707963267948966 }, | |
114 | }; | |
115 | const double toler004 = 2.5000000000000020e-13; | |
116 | ||
117 | // Test data for k=-0.50000000000000000. | |
118 | // max(|f - f_GSL|): 2.2204460492503131e-16 | |
119 | // max(|f - f_GSL| / |f_GSL|): 3.2412420886495652e-16 | |
120 | const testcase_ellint_2<double> | |
121 | data005[10] = | |
122 | { | |
123 | { 0.0000000000000000, -0.50000000000000000, 0.0000000000000000 }, | |
124 | { 0.17431249677315910, -0.50000000000000000, 0.17453292519943295 }, | |
125 | { 0.34732862537770803, -0.50000000000000000, 0.34906585039886590 }, | |
126 | { 0.51788193485993794, -0.50000000000000000, 0.52359877559829882 }, | |
127 | { 0.68506022954164536, -0.50000000000000000, 0.69813170079773179 }, | |
128 | { 0.84831662803347196, -0.50000000000000000, 0.87266462599716477 }, | |
129 | { 1.0075555551444717, -0.50000000000000000, 1.0471975511965976 }, | |
130 | { 1.1631768599287300, -0.50000000000000000, 1.2217304763960306 }, | |
131 | { 1.3160584048772543, -0.50000000000000000, 1.3962634015954636 }, | |
132 | { 1.4674622093394274, -0.50000000000000000, 1.5707963267948966 }, | |
133 | }; | |
134 | const double toler005 = 2.5000000000000020e-13; | |
135 | ||
136 | // Test data for k=-0.40000000000000002. | |
137 | // max(|f - f_GSL|): 6.6613381477509392e-16 | |
138 | // max(|f - f_GSL| / |f_GSL|): 5.6222658248988364e-16 | |
139 | const testcase_ellint_2<double> | |
140 | data006[10] = | |
141 | { | |
142 | { 0.0000000000000000, -0.40000000000000002, 0.0000000000000000 }, | |
143 | { 0.17439190872481267, -0.40000000000000002, 0.17453292519943295 }, | |
144 | { 0.34795581767099210, -0.40000000000000002, 0.34906585039886590 }, | |
145 | { 0.51995290683804463, -0.40000000000000002, 0.52359877559829882 }, | |
146 | { 0.68981638464431538, -0.40000000000000002, 0.69813170079773179 }, | |
147 | { 0.85722088859936041, -0.40000000000000002, 0.87266462599716477 }, | |
148 | { 1.0221301327876993, -0.40000000000000002, 1.0471975511965976 }, | |
149 | { 1.1848138019818371, -0.40000000000000002, 1.2217304763960306 }, | |
150 | { 1.3458259266501533, -0.40000000000000002, 1.3962634015954636 }, | |
151 | { 1.5059416123600402, -0.40000000000000002, 1.5707963267948966 }, | |
152 | }; | |
153 | const double toler006 = 2.5000000000000020e-13; | |
154 | ||
155 | // Test data for k=-0.30000000000000004. | |
156 | // max(|f - f_GSL|): 8.8817841970012523e-16 | |
157 | // max(|f - f_GSL| / |f_GSL|): 6.3860540218057383e-16 | |
158 | const testcase_ellint_2<double> | |
159 | data007[10] = | |
160 | { | |
161 | { 0.0000000000000000, -0.30000000000000004, 0.0000000000000000 }, | |
162 | { 0.17445362864048913, -0.30000000000000004, 0.17453292519943295 }, | |
163 | { 0.34844223535713464, -0.30000000000000004, 0.34906585039886590 }, | |
164 | { 0.52155353877411770, -0.30000000000000004, 0.52359877559829882 }, | |
165 | { 0.69347584418369879, -0.30000000000000004, 0.69813170079773179 }, | |
166 | { 0.86403609928237668, -0.30000000000000004, 0.87266462599716477 }, | |
167 | { 1.0332234514065408, -0.30000000000000004, 1.0471975511965976 }, | |
168 | { 1.2011943182068923, -0.30000000000000004, 1.2217304763960306 }, | |
169 | { 1.3682566113689623, -0.30000000000000004, 1.3962634015954636 }, | |
170 | { 1.5348334649232491, -0.30000000000000004, 1.5707963267948966 }, | |
171 | }; | |
172 | const double toler007 = 2.5000000000000020e-13; | |
173 | ||
174 | // Test data for k=-0.19999999999999996. | |
175 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
176 | // max(|f - f_GSL| / |f_GSL|): 4.2658819988515356e-16 | |
177 | const testcase_ellint_2<double> | |
178 | data008[10] = | |
179 | { | |
180 | { 0.0000000000000000, -0.19999999999999996, 0.0000000000000000 }, | |
181 | { 0.17449769027652812, -0.19999999999999996, 0.17453292519943295 }, | |
182 | { 0.34878893400762095, -0.19999999999999996, 0.34906585039886590 }, | |
183 | { 0.52269152856057410, -0.19999999999999996, 0.52359877559829882 }, | |
184 | { 0.69606913360157563, -0.19999999999999996, 0.69813170079773179 }, | |
185 | { 0.86884782374863356, -0.19999999999999996, 0.87266462599716477 }, | |
186 | { 1.0410255369689567, -0.19999999999999996, 1.0471975511965976 }, | |
187 | { 1.2126730391631360, -0.19999999999999996, 1.2217304763960306 }, | |
188 | { 1.3839259540325153, -0.19999999999999996, 1.3962634015954636 }, | |
189 | { 1.5549685462425291, -0.19999999999999996, 1.5707963267948966 }, | |
190 | }; | |
191 | const double toler008 = 2.5000000000000020e-13; | |
192 | ||
193 | // Test data for k=-0.099999999999999978. | |
194 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
195 | // max(|f - f_GSL| / |f_GSL|): 3.1875595485348029e-16 | |
196 | const testcase_ellint_2<double> | |
197 | data009[10] = | |
198 | { | |
199 | { 0.0000000000000000, -0.099999999999999978, 0.0000000000000000 }, | |
200 | { 0.17452411766649939, -0.099999999999999978, 0.17453292519943295 }, | |
201 | { 0.34899665805442404, -0.099999999999999978, 0.34906585039886590 }, | |
202 | { 0.52337222400508776, -0.099999999999999978, 0.52359877559829882 }, | |
203 | { 0.69761705217284864, -0.099999999999999978, 0.69813170079773179 }, | |
204 | { 0.87171309273007491, -0.099999999999999978, 0.87266462599716477 }, | |
205 | { 1.0456602197056326, -0.099999999999999978, 1.0471975511965976 }, | |
206 | { 1.2194762899272025, -0.099999999999999978, 1.2217304763960306 }, | |
207 | { 1.3931950229892744, -0.099999999999999978, 1.3962634015954636 }, | |
208 | { 1.5668619420216685, -0.099999999999999978, 1.5707963267948966 }, | |
209 | }; | |
210 | const double toler009 = 2.5000000000000020e-13; | |
211 | ||
212 | // Test data for k=0.0000000000000000. | |
213 | // max(|f - f_GSL|): 2.2204460492503131e-16 | |
214 | // max(|f - f_GSL| / |f_GSL|): 2.1203697876423452e-16 | |
215 | const testcase_ellint_2<double> | |
216 | data010[10] = | |
217 | { | |
218 | { 0.0000000000000000, 0.0000000000000000, 0.0000000000000000 }, | |
219 | { 0.17453292519943292, 0.0000000000000000, 0.17453292519943295 }, | |
220 | { 0.34906585039886584, 0.0000000000000000, 0.34906585039886590 }, | |
221 | { 0.52359877559829870, 0.0000000000000000, 0.52359877559829882 }, | |
222 | { 0.69813170079773168, 0.0000000000000000, 0.69813170079773179 }, | |
223 | { 0.87266462599716477, 0.0000000000000000, 0.87266462599716477 }, | |
224 | { 1.0471975511965974, 0.0000000000000000, 1.0471975511965976 }, | |
225 | { 1.2217304763960304, 0.0000000000000000, 1.2217304763960306 }, | |
226 | { 1.3962634015954631, 0.0000000000000000, 1.3962634015954636 }, | |
227 | { 1.5707963267948966, 0.0000000000000000, 1.5707963267948966 }, | |
228 | }; | |
229 | const double toler010 = 2.5000000000000020e-13; | |
230 | ||
231 | // Test data for k=0.10000000000000009. | |
232 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
233 | // max(|f - f_GSL| / |f_GSL|): 3.1875595485348029e-16 | |
234 | const testcase_ellint_2<double> | |
235 | data011[10] = | |
236 | { | |
237 | { 0.0000000000000000, 0.10000000000000009, 0.0000000000000000 }, | |
238 | { 0.17452411766649939, 0.10000000000000009, 0.17453292519943295 }, | |
239 | { 0.34899665805442404, 0.10000000000000009, 0.34906585039886590 }, | |
240 | { 0.52337222400508776, 0.10000000000000009, 0.52359877559829882 }, | |
241 | { 0.69761705217284864, 0.10000000000000009, 0.69813170079773179 }, | |
242 | { 0.87171309273007491, 0.10000000000000009, 0.87266462599716477 }, | |
243 | { 1.0456602197056326, 0.10000000000000009, 1.0471975511965976 }, | |
244 | { 1.2194762899272025, 0.10000000000000009, 1.2217304763960306 }, | |
245 | { 1.3931950229892744, 0.10000000000000009, 1.3962634015954636 }, | |
246 | { 1.5668619420216685, 0.10000000000000009, 1.5707963267948966 }, | |
247 | }; | |
248 | const double toler011 = 2.5000000000000020e-13; | |
249 | ||
250 | // Test data for k=0.19999999999999996. | |
251 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
252 | // max(|f - f_GSL| / |f_GSL|): 4.2658819988515356e-16 | |
253 | const testcase_ellint_2<double> | |
254 | data012[10] = | |
255 | { | |
256 | { 0.0000000000000000, 0.19999999999999996, 0.0000000000000000 }, | |
257 | { 0.17449769027652812, 0.19999999999999996, 0.17453292519943295 }, | |
258 | { 0.34878893400762095, 0.19999999999999996, 0.34906585039886590 }, | |
259 | { 0.52269152856057410, 0.19999999999999996, 0.52359877559829882 }, | |
260 | { 0.69606913360157563, 0.19999999999999996, 0.69813170079773179 }, | |
261 | { 0.86884782374863356, 0.19999999999999996, 0.87266462599716477 }, | |
262 | { 1.0410255369689567, 0.19999999999999996, 1.0471975511965976 }, | |
263 | { 1.2126730391631360, 0.19999999999999996, 1.2217304763960306 }, | |
264 | { 1.3839259540325153, 0.19999999999999996, 1.3962634015954636 }, | |
265 | { 1.5549685462425291, 0.19999999999999996, 1.5707963267948966 }, | |
266 | }; | |
267 | const double toler012 = 2.5000000000000020e-13; | |
268 | ||
269 | // Test data for k=0.30000000000000004. | |
270 | // max(|f - f_GSL|): 8.8817841970012523e-16 | |
271 | // max(|f - f_GSL| / |f_GSL|): 6.3860540218057383e-16 | |
272 | const testcase_ellint_2<double> | |
273 | data013[10] = | |
274 | { | |
275 | { 0.0000000000000000, 0.30000000000000004, 0.0000000000000000 }, | |
276 | { 0.17445362864048913, 0.30000000000000004, 0.17453292519943295 }, | |
277 | { 0.34844223535713464, 0.30000000000000004, 0.34906585039886590 }, | |
278 | { 0.52155353877411770, 0.30000000000000004, 0.52359877559829882 }, | |
279 | { 0.69347584418369879, 0.30000000000000004, 0.69813170079773179 }, | |
280 | { 0.86403609928237668, 0.30000000000000004, 0.87266462599716477 }, | |
281 | { 1.0332234514065408, 0.30000000000000004, 1.0471975511965976 }, | |
282 | { 1.2011943182068923, 0.30000000000000004, 1.2217304763960306 }, | |
283 | { 1.3682566113689623, 0.30000000000000004, 1.3962634015954636 }, | |
284 | { 1.5348334649232491, 0.30000000000000004, 1.5707963267948966 }, | |
285 | }; | |
286 | const double toler013 = 2.5000000000000020e-13; | |
287 | ||
288 | // Test data for k=0.39999999999999991. | |
289 | // max(|f - f_GSL|): 8.8817841970012523e-16 | |
290 | // max(|f - f_GSL| / |f_GSL|): 5.8978277272530773e-16 | |
291 | const testcase_ellint_2<double> | |
292 | data014[10] = | |
293 | { | |
294 | { 0.0000000000000000, 0.39999999999999991, 0.0000000000000000 }, | |
295 | { 0.17439190872481267, 0.39999999999999991, 0.17453292519943295 }, | |
296 | { 0.34795581767099210, 0.39999999999999991, 0.34906585039886590 }, | |
297 | { 0.51995290683804463, 0.39999999999999991, 0.52359877559829882 }, | |
298 | { 0.68981638464431538, 0.39999999999999991, 0.69813170079773179 }, | |
299 | { 0.85722088859936041, 0.39999999999999991, 0.87266462599716477 }, | |
300 | { 1.0221301327876993, 0.39999999999999991, 1.0471975511965976 }, | |
301 | { 1.1848138019818373, 0.39999999999999991, 1.2217304763960306 }, | |
302 | { 1.3458259266501533, 0.39999999999999991, 1.3962634015954636 }, | |
303 | { 1.5059416123600404, 0.39999999999999991, 1.5707963267948966 }, | |
304 | }; | |
305 | const double toler014 = 2.5000000000000020e-13; | |
306 | ||
307 | // Test data for k=0.50000000000000000. | |
308 | // max(|f - f_GSL|): 2.2204460492503131e-16 | |
309 | // max(|f - f_GSL| / |f_GSL|): 3.2412420886495652e-16 | |
310 | const testcase_ellint_2<double> | |
311 | data015[10] = | |
312 | { | |
313 | { 0.0000000000000000, 0.50000000000000000, 0.0000000000000000 }, | |
314 | { 0.17431249677315910, 0.50000000000000000, 0.17453292519943295 }, | |
315 | { 0.34732862537770803, 0.50000000000000000, 0.34906585039886590 }, | |
316 | { 0.51788193485993794, 0.50000000000000000, 0.52359877559829882 }, | |
317 | { 0.68506022954164536, 0.50000000000000000, 0.69813170079773179 }, | |
318 | { 0.84831662803347196, 0.50000000000000000, 0.87266462599716477 }, | |
319 | { 1.0075555551444717, 0.50000000000000000, 1.0471975511965976 }, | |
320 | { 1.1631768599287300, 0.50000000000000000, 1.2217304763960306 }, | |
321 | { 1.3160584048772543, 0.50000000000000000, 1.3962634015954636 }, | |
322 | { 1.4674622093394274, 0.50000000000000000, 1.5707963267948966 }, | |
323 | }; | |
324 | const double toler015 = 2.5000000000000020e-13; | |
325 | ||
326 | // Test data for k=0.60000000000000009. | |
327 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
328 | // max(|f - f_GSL| / |f_GSL|): 3.9101039108874066e-16 | |
329 | const testcase_ellint_2<double> | |
330 | data016[10] = | |
331 | { | |
332 | { 0.0000000000000000, 0.60000000000000009, 0.0000000000000000 }, | |
333 | { 0.17421534919599127, 0.60000000000000009, 0.17453292519943295 }, | |
334 | { 0.34655927787174101, 0.60000000000000009, 0.34906585039886590 }, | |
335 | { 0.51533034538432143, 0.60000000000000009, 0.52359877559829882 }, | |
336 | { 0.67916550597453018, 0.60000000000000009, 0.69813170079773179 }, | |
337 | { 0.83720218180349870, 0.60000000000000009, 0.87266462599716477 }, | |
338 | { 0.98922159354937744, 0.60000000000000009, 1.0471975511965976 }, | |
339 | { 1.1357478470419360, 0.60000000000000009, 1.2217304763960306 }, | |
340 | { 1.2780617372844056, 0.60000000000000009, 1.3962634015954636 }, | |
341 | { 1.4180833944487241, 0.60000000000000009, 1.5707963267948966 }, | |
342 | }; | |
343 | const double toler016 = 2.5000000000000020e-13; | |
344 | ||
345 | // Test data for k=0.69999999999999996. | |
346 | // max(|f - f_GSL|): 3.3306690738754696e-16 | |
347 | // max(|f - f_GSL| / |f_GSL|): 4.0435005012914979e-16 | |
348 | const testcase_ellint_2<double> | |
349 | data017[10] = | |
350 | { | |
351 | { 0.0000000000000000, 0.69999999999999996, 0.0000000000000000 }, | |
352 | { 0.17410041242702542, 0.69999999999999996, 0.17453292519943295 }, | |
353 | { 0.34564605085764760, 0.69999999999999996, 0.34906585039886590 }, | |
354 | { 0.51228495693314646, 0.69999999999999996, 0.52359877559829882 }, | |
355 | { 0.67207654098799530, 0.69999999999999996, 0.69813170079773179 }, | |
356 | { 0.82370932631556515, 0.69999999999999996, 0.87266462599716477 }, | |
357 | { 0.96672313309452795, 0.69999999999999996, 1.0471975511965976 }, | |
358 | { 1.1017090644949503, 0.69999999999999996, 1.2217304763960306 }, | |
359 | { 1.2304180097292914, 0.69999999999999996, 1.3962634015954636 }, | |
360 | { 1.3556611355719554, 0.69999999999999996, 1.5707963267948966 }, | |
361 | }; | |
362 | const double toler017 = 2.5000000000000020e-13; | |
363 | ||
364 | // Test data for k=0.80000000000000004. | |
365 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
366 | // max(|f - f_GSL| / |f_GSL|): 3.4793687438660849e-16 | |
367 | const testcase_ellint_2<double> | |
368 | data018[10] = | |
369 | { | |
370 | { 0.0000000000000000, 0.80000000000000004, 0.0000000000000000 }, | |
371 | { 0.17396762274534805, 0.80000000000000004, 0.17453292519943295 }, | |
372 | { 0.34458685226969316, 0.80000000000000004, 0.34906585039886590 }, | |
373 | { 0.50872923654502433, 0.80000000000000004, 0.52359877559829882 }, | |
374 | { 0.66372016539176215, 0.80000000000000004, 0.69813170079773179 }, | |
375 | { 0.80760344410167406, 0.80000000000000004, 0.87266462599716477 }, | |
376 | { 0.93945480372495049, 0.80000000000000004, 1.0471975511965976 }, | |
377 | { 1.0597473310395036, 0.80000000000000004, 1.2217304763960306 }, | |
378 | { 1.1706981862452361, 0.80000000000000004, 1.3962634015954636 }, | |
379 | { 1.2763499431699064, 0.80000000000000004, 1.5707963267948966 }, | |
380 | }; | |
381 | const double toler018 = 2.5000000000000020e-13; | |
382 | ||
383 | // Test data for k=0.89999999999999991. | |
384 | // max(|f - f_GSL|): 4.4408920985006262e-16 | |
385 | // max(|f - f_GSL| / |f_GSL|): 3.7901367831880493e-16 | |
386 | const testcase_ellint_2<double> | |
387 | data019[10] = | |
388 | { | |
389 | { 0.0000000000000000, 0.89999999999999991, 0.0000000000000000 }, | |
390 | { 0.17381690606167960, 0.89999999999999991, 0.17453292519943295 }, | |
391 | { 0.34337919186972055, 0.89999999999999991, 0.34906585039886590 }, | |
392 | { 0.50464268659856326, 0.89999999999999991, 0.52359877559829882 }, | |
393 | { 0.65400003842368570, 0.89999999999999991, 0.69813170079773179 }, | |
394 | { 0.78854928419904657, 0.89999999999999991, 0.87266462599716477 }, | |
395 | { 0.90645698626315407, 0.89999999999999991, 1.0471975511965976 }, | |
396 | { 1.0075154899135930, 0.89999999999999991, 1.2217304763960306 }, | |
397 | { 1.0940135583194071, 0.89999999999999991, 1.3962634015954636 }, | |
398 | { 1.1716970527816144, 0.89999999999999991, 1.5707963267948966 }, | |
399 | }; | |
400 | const double toler019 = 2.5000000000000020e-13; | |
401 | ||
402 | template<typename Tp, unsigned int Num> | |
403 | void | |
404 | test(const testcase_ellint_2<Tp> (&data)[Num], Tp toler) | |
405 | { | |
406 | bool test __attribute__((unused)) = true; | |
407 | const Tp eps = std::numeric_limits<Tp>::epsilon(); | |
408 | Tp max_abs_diff = -Tp(1); | |
409 | Tp max_abs_frac = -Tp(1); | |
410 | unsigned int num_datum = Num; | |
411 | for (unsigned int i = 0; i < num_datum; ++i) | |
412 | { | |
413 | const Tp f = std::ellint_2(data[i].k, data[i].phi); | |
414 | const Tp f0 = data[i].f0; | |
415 | const Tp diff = f - f0; | |
416 | if (std::abs(diff) > max_abs_diff) | |
417 | max_abs_diff = std::abs(diff); | |
418 | if (std::abs(f0) > Tp(10) * eps | |
419 | && std::abs(f) > Tp(10) * eps) | |
420 | { | |
421 | const Tp frac = diff / f0; | |
422 | if (std::abs(frac) > max_abs_frac) | |
423 | max_abs_frac = std::abs(frac); | |
424 | } | |
425 | } | |
426 | VERIFY(max_abs_frac < toler); | |
427 | } | |
428 | ||
429 | int | |
430 | main() | |
431 | { | |
432 | test(data001, toler001); | |
433 | test(data002, toler002); | |
434 | test(data003, toler003); | |
435 | test(data004, toler004); | |
436 | test(data005, toler005); | |
437 | test(data006, toler006); | |
438 | test(data007, toler007); | |
439 | test(data008, toler008); | |
440 | test(data009, toler009); | |
441 | test(data010, toler010); | |
442 | test(data011, toler011); | |
443 | test(data012, toler012); | |
444 | test(data013, toler013); | |
445 | test(data014, toler014); | |
446 | test(data015, toler015); | |
447 | test(data016, toler016); | |
448 | test(data017, toler017); | |
449 | test(data018, toler018); | |
450 | test(data019, toler019); | |
451 | return 0; | |
452 | } |