]>
Commit | Line | Data |
---|---|---|
b4688136 ESR |
1 | // { dg-do run { target c++11 } } |
2 | // { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" } | |
7c62b943 | 3 | // |
83ffe9cd | 4 | // Copyright (C) 2016-2023 Free Software Foundation, Inc. |
7c62b943 BK |
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 | |
748086b7 | 9 | // Free Software Foundation; either version 3, or (at your option) |
7c62b943 BK |
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 | |
748086b7 JJ |
18 | // with this library; see the file COPYING3. If not see |
19 | // <http://www.gnu.org/licenses/>. | |
7c62b943 BK |
20 | |
21 | // ellint_1 | |
7c62b943 BK |
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/ | |
b4688136 | 24 | #include <limits> |
7c62b943 BK |
25 | #include <tr1/cmath> |
26 | #if defined(__TEST_DEBUG) | |
b4688136 ESR |
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 | } | |
7c62b943 | 35 | #else |
b4688136 | 36 | # include <testsuite_hooks.h> |
7c62b943 | 37 | #endif |
b4688136 | 38 | #include <specfun_testcase.h> |
7c62b943 BK |
39 | |
40 | // Test data for k=-0.90000000000000002. | |
b4688136 ESR |
41 | // max(|f - f_Boost|): 8.8817841970012523e-16 at index 7 |
42 | // max(|f - f_Boost| / |f_Boost|): 5.7842011620951154e-16 | |
43 | // mean(f - f_Boost): 5.8286708792820721e-17 | |
44 | // variance(f - f_Boost): 4.1942474344433133e-34 | |
45 | // stddev(f - f_Boost): 2.0479861900030756e-17 | |
46 | const testcase_ellint_1<double> | |
47 | data001[10] = | |
7c62b943 | 48 | { |
b4688136 ESR |
49 | { 0.0000000000000000, -0.90000000000000002, 0.0000000000000000, 0.0 }, |
50 | { 0.17525427376115027, -0.90000000000000002, 0.17453292519943295, 0.0 }, | |
51 | { 0.35492464591297446, -0.90000000000000002, 0.34906585039886590, 0.0 }, | |
52 | { 0.54388221416157123, -0.90000000000000002, 0.52359877559829882, 0.0 }, | |
53 | { 0.74797400423532512, -0.90000000000000002, 0.69813170079773179, 0.0 }, | |
54 | { 0.97463898451966446, -0.90000000000000002, 0.87266462599716477, 0.0 }, | |
55 | { 1.2334463254523438, -0.90000000000000002, 1.0471975511965976, 0.0 }, | |
56 | { 1.5355247765594913, -0.90000000000000002, 1.2217304763960306, 0.0 }, | |
57 | { 1.8882928567775126, -0.90000000000000002, 1.3962634015954636, 0.0 }, | |
58 | { 2.2805491384227703, -0.90000000000000002, 1.5707963267948966, 0.0 }, | |
7c62b943 | 59 | }; |
b4688136 | 60 | const double toler001 = 2.5000000000000020e-13; |
7c62b943 | 61 | |
b4688136 ESR |
62 | // Test data for k=-0.80000000000000004. |
63 | // max(|f - f_Boost|): 8.8817841970012523e-16 at index 8 | |
64 | // max(|f - f_Boost| / |f_Boost|): 5.2032670495747184e-16 | |
65 | // mean(f - f_Boost): 1.9428902930940239e-16 | |
66 | // variance(f - f_Boost): 2.7486111305082033e-32 | |
67 | // stddev(f - f_Boost): 1.6578935823834422e-16 | |
68 | const testcase_ellint_1<double> | |
69 | data002[10] = | |
7c62b943 | 70 | { |
b4688136 ESR |
71 | { 0.0000000000000000, -0.80000000000000004, 0.0000000000000000, 0.0 }, |
72 | { 0.17510154241338899, -0.80000000000000004, 0.17453292519943295, 0.0 }, | |
73 | { 0.35365068839779396, -0.80000000000000004, 0.34906585039886590, 0.0 }, | |
74 | { 0.53926804409084550, -0.80000000000000004, 0.52359877559829882, 0.0 }, | |
75 | { 0.73587926028070372, -0.80000000000000004, 0.69813170079773179, 0.0 }, | |
76 | { 0.94770942970071170, -0.80000000000000004, 0.87266462599716477, 0.0 }, | |
77 | { 1.1789022995388236, -0.80000000000000004, 1.0471975511965976, 0.0 }, | |
78 | { 1.4323027881876012, -0.80000000000000004, 1.2217304763960306, 0.0 }, | |
79 | { 1.7069629739121677, -0.80000000000000004, 1.3962634015954636, 0.0 }, | |
80 | { 1.9953027776647294, -0.80000000000000004, 1.5707963267948966, 0.0 }, | |
7c62b943 | 81 | }; |
b4688136 | 82 | const double toler002 = 2.5000000000000020e-13; |
7c62b943 | 83 | |
b4688136 ESR |
84 | // Test data for k=-0.69999999999999996. |
85 | // max(|f - f_Boost|): 8.8817841970012523e-16 at index 8 | |
86 | // max(|f - f_Boost| / |f_Boost|): 5.5425633303580569e-16 | |
87 | // mean(f - f_Boost): 3.3306690738754695e-17 | |
88 | // variance(f - f_Boost): 2.8136647641852830e-32 | |
89 | // stddev(f - f_Boost): 1.6773982127644239e-16 | |
90 | const testcase_ellint_1<double> | |
91 | data003[10] = | |
7c62b943 | 92 | { |
b4688136 ESR |
93 | { 0.0000000000000000, -0.69999999999999996, 0.0000000000000000, 0.0 }, |
94 | { 0.17496737466916723, -0.69999999999999996, 0.17453292519943295, 0.0 }, | |
95 | { 0.35254687535677931, -0.69999999999999996, 0.34906585039886590, 0.0 }, | |
96 | { 0.53536740275997130, -0.69999999999999996, 0.52359877559829882, 0.0 }, | |
97 | { 0.72603797651684454, -0.69999999999999996, 0.69813170079773179, 0.0 }, | |
98 | { 0.92698296348313447, -0.69999999999999996, 0.87266462599716477, 0.0 }, | |
99 | { 1.1400447527693316, -0.69999999999999996, 1.0471975511965976, 0.0 }, | |
100 | { 1.3657668117194071, -0.69999999999999996, 1.2217304763960306, 0.0 }, | |
101 | { 1.6024686895959162, -0.69999999999999996, 1.3962634015954636, 0.0 }, | |
102 | { 1.8456939983747234, -0.69999999999999996, 1.5707963267948966, 0.0 }, | |
7c62b943 | 103 | }; |
b4688136 | 104 | const double toler003 = 2.5000000000000020e-13; |
7c62b943 | 105 | |
b4688136 ESR |
106 | // Test data for k=-0.59999999999999998. |
107 | // max(|f - f_Boost|): 4.4408920985006262e-16 at index 7 | |
108 | // max(|f - f_Boost| / |f_Boost|): 3.3664899092028927e-16 | |
109 | // mean(f - f_Boost): 5.2735593669694933e-17 | |
110 | // variance(f - f_Boost): 3.4333862218458872e-34 | |
111 | // stddev(f - f_Boost): 1.8529398861932589e-17 | |
112 | const testcase_ellint_1<double> | |
113 | data004[10] = | |
7c62b943 | 114 | { |
b4688136 ESR |
115 | { 0.0000000000000000, -0.59999999999999998, 0.0000000000000000, 0.0 }, |
116 | { 0.17485154362988359, -0.59999999999999998, 0.17453292519943295, 0.0 }, | |
117 | { 0.35160509865544320, -0.59999999999999998, 0.34906585039886590, 0.0 }, | |
118 | { 0.53210652578446138, -0.59999999999999998, 0.52359877559829882, 0.0 }, | |
119 | { 0.71805304664485659, -0.59999999999999998, 0.69813170079773179, 0.0 }, | |
120 | { 0.91082759030195981, -0.59999999999999998, 0.87266462599716477, 0.0 }, | |
121 | { 1.1112333229323361, -0.59999999999999998, 1.0471975511965976, 0.0 }, | |
122 | { 1.3191461190365270, -0.59999999999999998, 1.2217304763960306, 0.0 }, | |
123 | { 1.5332022105084779, -0.59999999999999998, 1.3962634015954636, 0.0 }, | |
124 | { 1.7507538029157523, -0.59999999999999998, 1.5707963267948966, 0.0 }, | |
7c62b943 | 125 | }; |
b4688136 | 126 | const double toler004 = 2.5000000000000020e-13; |
7c62b943 | 127 | |
b4688136 ESR |
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.4551389361831220e-16 | |
131 | // mean(f - f_Boost): -5.8286708792820721e-17 | |
132 | // variance(f - f_Boost): 4.1942474344433133e-34 | |
133 | // stddev(f - f_Boost): 2.0479861900030756e-17 | |
134 | const testcase_ellint_1<double> | |
135 | data005[10] = | |
7c62b943 | 136 | { |
b4688136 ESR |
137 | { 0.0000000000000000, -0.50000000000000000, 0.0000000000000000, 0.0 }, |
138 | { 0.17475385514035785, -0.50000000000000000, 0.17453292519943295, 0.0 }, | |
139 | { 0.35081868470101579, -0.50000000000000000, 0.34906585039886590, 0.0 }, | |
140 | { 0.52942862705190574, -0.50000000000000000, 0.52359877559829882, 0.0 }, | |
141 | { 0.71164727562630326, -0.50000000000000000, 0.69813170079773179, 0.0 }, | |
142 | { 0.89824523594227768, -0.50000000000000000, 0.87266462599716477, 0.0 }, | |
143 | { 1.0895506700518853, -0.50000000000000000, 1.0471975511965976, 0.0 }, | |
144 | { 1.2853005857432933, -0.50000000000000000, 1.2217304763960306, 0.0 }, | |
145 | { 1.4845545520549488, -0.50000000000000000, 1.3962634015954636, 0.0 }, | |
146 | { 1.6857503548125961, -0.50000000000000000, 1.5707963267948966, 0.0 }, | |
7c62b943 | 147 | }; |
b4688136 ESR |
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|): 3.1423314994346225e-16 | |
153 | // mean(f - f_Boost): -6.9388939039072284e-17 | |
154 | // variance(f - f_Boost): 1.7333369499485123e-32 | |
155 | // stddev(f - f_Boost): 1.3165625507162629e-16 | |
156 | const testcase_ellint_1<double> | |
157 | data006[10] = | |
7c62b943 | 158 | { |
b4688136 ESR |
159 | { 0.0000000000000000, -0.39999999999999991, 0.0000000000000000, 0.0 }, |
160 | { 0.17467414669441528, -0.39999999999999991, 0.17453292519943295, 0.0 }, | |
161 | { 0.35018222772483443, -0.39999999999999991, 0.34906585039886590, 0.0 }, | |
162 | { 0.52729015917508748, -0.39999999999999991, 0.52359877559829882, 0.0 }, | |
163 | { 0.70662374407341244, -0.39999999999999991, 0.69813170079773179, 0.0 }, | |
164 | { 0.88859210497602159, -0.39999999999999991, 0.87266462599716477, 0.0 }, | |
165 | { 1.0733136290471381, -0.39999999999999991, 1.0471975511965976, 0.0 }, | |
166 | { 1.2605612170157066, -0.39999999999999991, 1.2217304763960306, 0.0 }, | |
167 | { 1.4497513956433439, -0.39999999999999991, 1.3962634015954636, 0.0 }, | |
168 | { 1.6399998658645112, -0.39999999999999991, 1.5707963267948966, 0.0 }, | |
7c62b943 | 169 | }; |
b4688136 ESR |
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.2241249691539529e-16 | |
175 | // mean(f - f_Boost): -8.3266726846886741e-17 | |
176 | // variance(f - f_Boost): 4.1942474344433135e-32 | |
177 | // stddev(f - f_Boost): 2.0479861900030756e-16 | |
178 | const testcase_ellint_1<double> | |
179 | data007[10] = | |
7c62b943 | 180 | { |
b4688136 ESR |
181 | { 0.0000000000000000, -0.29999999999999993, 0.0000000000000000, 0.0 }, |
182 | { 0.17461228653000099, -0.29999999999999993, 0.17453292519943295, 0.0 }, | |
183 | { 0.34969146102798421, -0.29999999999999993, 0.34906585039886590, 0.0 }, | |
184 | { 0.52565822873726309, -0.29999999999999993, 0.52359877559829882, 0.0 }, | |
185 | { 0.70284226512408543, -0.29999999999999993, 0.69813170079773179, 0.0 }, | |
186 | { 0.88144139195111171, -0.29999999999999993, 0.87266462599716477, 0.0 }, | |
187 | { 1.0614897067260520, -0.29999999999999993, 1.0471975511965976, 0.0 }, | |
188 | { 1.2428416824174220, -0.29999999999999993, 1.2217304763960306, 0.0 }, | |
189 | { 1.4251795877015929, -0.29999999999999993, 1.3962634015954636, 0.0 }, | |
190 | { 1.6080486199305126, -0.29999999999999993, 1.5707963267948966, 0.0 }, | |
7c62b943 | 191 | }; |
b4688136 | 192 | const double toler007 = 2.5000000000000020e-13; |
7c62b943 | 193 | |
b4688136 ESR |
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.2156475739151676e-16 | |
197 | // mean(f - f_Boost): -9.7144514654701197e-17 | |
198 | // variance(f - f_Boost): 1.1650687317898094e-33 | |
199 | // stddev(f - f_Boost): 3.4133103166717924e-17 | |
200 | const testcase_ellint_1<double> | |
201 | data008[10] = | |
7c62b943 | 202 | { |
b4688136 ESR |
203 | { 0.0000000000000000, -0.19999999999999996, 0.0000000000000000, 0.0 }, |
204 | { 0.17456817290292806, -0.19999999999999996, 0.17453292519943295, 0.0 }, | |
205 | { 0.34934315932086796, -0.19999999999999996, 0.34906585039886590, 0.0 }, | |
206 | { 0.52450880529443988, -0.19999999999999996, 0.52359877559829882, 0.0 }, | |
207 | { 0.70020491009844887, -0.19999999999999996, 0.69813170079773179, 0.0 }, | |
208 | { 0.87651006649967977, -0.19999999999999996, 0.87266462599716477, 0.0 }, | |
209 | { 1.0534305870298994, -0.19999999999999996, 1.0471975511965976, 0.0 }, | |
210 | { 1.2308975521670789, -0.19999999999999996, 1.2217304763960306, 0.0 }, | |
211 | { 1.4087733584990738, -0.19999999999999996, 1.3962634015954636, 0.0 }, | |
212 | { 1.5868678474541662, -0.19999999999999996, 1.5707963267948966, 0.0 }, | |
7c62b943 | 213 | }; |
b4688136 | 214 | const double toler008 = 2.5000000000000020e-13; |
7c62b943 | 215 | |
b4688136 ESR |
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.1735566504509645e-16 | |
219 | // mean(f - f_Boost): -3.6082248300317589e-17 | |
220 | // variance(f - f_Boost): 8.2258607846939269e-33 | |
221 | // stddev(f - f_Boost): 9.0696531271564778e-17 | |
222 | const testcase_ellint_1<double> | |
223 | data009[10] = | |
7c62b943 | 224 | { |
b4688136 ESR |
225 | { 0.0000000000000000, -0.099999999999999978, 0.0000000000000000, 0.0 }, |
226 | { 0.17454173353063662, -0.099999999999999978, 0.17453292519943295, 0.0 }, | |
227 | { 0.34913506721468096, -0.099999999999999978, 0.34906585039886590, 0.0 }, | |
228 | { 0.52382550016538953, -0.099999999999999978, 0.52359877559829882, 0.0 }, | |
229 | { 0.69864700854177020, -0.099999999999999978, 0.69813170079773179, 0.0 }, | |
230 | { 0.87361792586964859, -0.099999999999999978, 0.87266462599716477, 0.0 }, | |
231 | { 1.0487386319621685, -0.099999999999999978, 1.0471975511965976, 0.0 }, | |
232 | { 1.2239913752078759, -0.099999999999999978, 1.2217304763960306, 0.0 }, | |
233 | { 1.3993423113684051, -0.099999999999999978, 1.3962634015954636, 0.0 }, | |
234 | { 1.5747455615173558, -0.099999999999999978, 1.5707963267948966, 0.0 }, | |
7c62b943 | 235 | }; |
b4688136 | 236 | const double toler009 = 2.5000000000000020e-13; |
7c62b943 | 237 | |
b4688136 ESR |
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_1<double> | |
245 | data010[10] = | |
7c62b943 | 246 | { |
b4688136 ESR |
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 }, | |
7c62b943 | 257 | }; |
b4688136 | 258 | const double toler010 = 2.5000000000000020e-13; |
7c62b943 | 259 | |
b4688136 ESR |
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.1735566504509645e-16 | |
263 | // mean(f - f_Boost): -5.8286708792820721e-17 | |
264 | // variance(f - f_Boost): 4.1942474344433133e-34 | |
265 | // stddev(f - f_Boost): 2.0479861900030756e-17 | |
266 | const testcase_ellint_1<double> | |
267 | data011[10] = | |
7c62b943 | 268 | { |
b4688136 ESR |
269 | { 0.0000000000000000, 0.10000000000000009, 0.0000000000000000, 0.0 }, |
270 | { 0.17454173353063662, 0.10000000000000009, 0.17453292519943295, 0.0 }, | |
271 | { 0.34913506721468096, 0.10000000000000009, 0.34906585039886590, 0.0 }, | |
272 | { 0.52382550016538953, 0.10000000000000009, 0.52359877559829882, 0.0 }, | |
273 | { 0.69864700854177020, 0.10000000000000009, 0.69813170079773179, 0.0 }, | |
274 | { 0.87361792586964859, 0.10000000000000009, 0.87266462599716477, 0.0 }, | |
275 | { 1.0487386319621685, 0.10000000000000009, 1.0471975511965976, 0.0 }, | |
276 | { 1.2239913752078759, 0.10000000000000009, 1.2217304763960306, 0.0 }, | |
277 | { 1.3993423113684051, 0.10000000000000009, 1.3962634015954636, 0.0 }, | |
278 | { 1.5747455615173560, 0.10000000000000009, 1.5707963267948966, 0.0 }, | |
7c62b943 | 279 | }; |
b4688136 ESR |
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.2156475739151676e-16 | |
285 | // mean(f - f_Boost): -9.7144514654701197e-17 | |
286 | // variance(f - f_Boost): 1.1650687317898094e-33 | |
287 | // stddev(f - f_Boost): 3.4133103166717924e-17 | |
288 | const testcase_ellint_1<double> | |
289 | data012[10] = | |
7c62b943 | 290 | { |
b4688136 ESR |
291 | { 0.0000000000000000, 0.20000000000000018, 0.0000000000000000, 0.0 }, |
292 | { 0.17456817290292806, 0.20000000000000018, 0.17453292519943295, 0.0 }, | |
293 | { 0.34934315932086796, 0.20000000000000018, 0.34906585039886590, 0.0 }, | |
294 | { 0.52450880529443988, 0.20000000000000018, 0.52359877559829882, 0.0 }, | |
295 | { 0.70020491009844887, 0.20000000000000018, 0.69813170079773179, 0.0 }, | |
296 | { 0.87651006649967977, 0.20000000000000018, 0.87266462599716477, 0.0 }, | |
297 | { 1.0534305870298994, 0.20000000000000018, 1.0471975511965976, 0.0 }, | |
298 | { 1.2308975521670789, 0.20000000000000018, 1.2217304763960306, 0.0 }, | |
299 | { 1.4087733584990738, 0.20000000000000018, 1.3962634015954636, 0.0 }, | |
300 | { 1.5868678474541662, 0.20000000000000018, 1.5707963267948966, 0.0 }, | |
7c62b943 | 301 | }; |
b4688136 | 302 | const double toler012 = 2.5000000000000020e-13; |
7c62b943 | 303 | |
b4688136 ESR |
304 | // Test data for k=0.30000000000000004. |
305 | // max(|f - f_Boost|): 8.8817841970012523e-16 at index 9 | |
306 | // max(|f - f_Boost| / |f_Boost|): 5.5233306300061082e-16 | |
307 | // mean(f - f_Boost): -1.0547118733938987e-16 | |
308 | // variance(f - f_Boost): 7.5633408838247182e-32 | |
309 | // stddev(f - f_Boost): 2.7501528837184157e-16 | |
310 | const testcase_ellint_1<double> | |
311 | data013[10] = | |
7c62b943 | 312 | { |
b4688136 ESR |
313 | { 0.0000000000000000, 0.30000000000000004, 0.0000000000000000, 0.0 }, |
314 | { 0.17461228653000099, 0.30000000000000004, 0.17453292519943295, 0.0 }, | |
315 | { 0.34969146102798421, 0.30000000000000004, 0.34906585039886590, 0.0 }, | |
316 | { 0.52565822873726309, 0.30000000000000004, 0.52359877559829882, 0.0 }, | |
317 | { 0.70284226512408543, 0.30000000000000004, 0.69813170079773179, 0.0 }, | |
318 | { 0.88144139195111171, 0.30000000000000004, 0.87266462599716477, 0.0 }, | |
319 | { 1.0614897067260520, 0.30000000000000004, 1.0471975511965976, 0.0 }, | |
320 | { 1.2428416824174220, 0.30000000000000004, 1.2217304763960306, 0.0 }, | |
321 | { 1.4251795877015929, 0.30000000000000004, 1.3962634015954636, 0.0 }, | |
322 | { 1.6080486199305128, 0.30000000000000004, 1.5707963267948966, 0.0 }, | |
7c62b943 | 323 | }; |
b4688136 ESR |
324 | const double toler013 = 2.5000000000000020e-13; |
325 | ||
326 | // Test data for k=0.40000000000000013. | |
327 | // max(|f - f_Boost|): 4.4408920985006262e-16 at index 9 | |
328 | // max(|f - f_Boost| / |f_Boost|): 3.1423314994346225e-16 | |
329 | // mean(f - f_Boost): -4.7184478546569152e-17 | |
330 | // variance(f - f_Boost): 1.9448563670505968e-32 | |
331 | // stddev(f - f_Boost): 1.3945810722401896e-16 | |
332 | const testcase_ellint_1<double> | |
333 | data014[10] = | |
7c62b943 | 334 | { |
b4688136 ESR |
335 | { 0.0000000000000000, 0.40000000000000013, 0.0000000000000000, 0.0 }, |
336 | { 0.17467414669441528, 0.40000000000000013, 0.17453292519943295, 0.0 }, | |
337 | { 0.35018222772483443, 0.40000000000000013, 0.34906585039886590, 0.0 }, | |
338 | { 0.52729015917508748, 0.40000000000000013, 0.52359877559829882, 0.0 }, | |
339 | { 0.70662374407341244, 0.40000000000000013, 0.69813170079773179, 0.0 }, | |
340 | { 0.88859210497602159, 0.40000000000000013, 0.87266462599716477, 0.0 }, | |
341 | { 1.0733136290471381, 0.40000000000000013, 1.0471975511965976, 0.0 }, | |
342 | { 1.2605612170157066, 0.40000000000000013, 1.2217304763960306, 0.0 }, | |
343 | { 1.4497513956433439, 0.40000000000000013, 1.3962634015954636, 0.0 }, | |
344 | { 1.6399998658645112, 0.40000000000000013, 1.5707963267948966, 0.0 }, | |
7c62b943 | 345 | }; |
b4688136 | 346 | const double toler014 = 2.5000000000000020e-13; |
7c62b943 | 347 | |
b4688136 ESR |
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.4551389361831220e-16 | |
351 | // mean(f - f_Boost): -5.8286708792820721e-17 | |
352 | // variance(f - f_Boost): 4.1942474344433133e-34 | |
353 | // stddev(f - f_Boost): 2.0479861900030756e-17 | |
354 | const testcase_ellint_1<double> | |
355 | data015[10] = | |
7c62b943 | 356 | { |
b4688136 ESR |
357 | { 0.0000000000000000, 0.50000000000000000, 0.0000000000000000, 0.0 }, |
358 | { 0.17475385514035785, 0.50000000000000000, 0.17453292519943295, 0.0 }, | |
359 | { 0.35081868470101579, 0.50000000000000000, 0.34906585039886590, 0.0 }, | |
360 | { 0.52942862705190574, 0.50000000000000000, 0.52359877559829882, 0.0 }, | |
361 | { 0.71164727562630326, 0.50000000000000000, 0.69813170079773179, 0.0 }, | |
362 | { 0.89824523594227768, 0.50000000000000000, 0.87266462599716477, 0.0 }, | |
363 | { 1.0895506700518853, 0.50000000000000000, 1.0471975511965976, 0.0 }, | |
364 | { 1.2853005857432933, 0.50000000000000000, 1.2217304763960306, 0.0 }, | |
365 | { 1.4845545520549488, 0.50000000000000000, 1.3962634015954636, 0.0 }, | |
366 | { 1.6857503548125961, 0.50000000000000000, 1.5707963267948966, 0.0 }, | |
7c62b943 | 367 | }; |
b4688136 | 368 | const double toler015 = 2.5000000000000020e-13; |
7c62b943 | 369 | |
b4688136 ESR |
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.3664899092028927e-16 | |
373 | // mean(f - f_Boost): 7.4940054162198071e-17 | |
374 | // variance(f - f_Boost): 2.6715739327327140e-33 | |
375 | // stddev(f - f_Boost): 5.1687270509601433e-17 | |
376 | const testcase_ellint_1<double> | |
377 | data016[10] = | |
7c62b943 | 378 | { |
b4688136 ESR |
379 | { 0.0000000000000000, 0.60000000000000009, 0.0000000000000000, 0.0 }, |
380 | { 0.17485154362988359, 0.60000000000000009, 0.17453292519943295, 0.0 }, | |
381 | { 0.35160509865544320, 0.60000000000000009, 0.34906585039886590, 0.0 }, | |
382 | { 0.53210652578446138, 0.60000000000000009, 0.52359877559829882, 0.0 }, | |
383 | { 0.71805304664485659, 0.60000000000000009, 0.69813170079773179, 0.0 }, | |
384 | { 0.91082759030195981, 0.60000000000000009, 0.87266462599716477, 0.0 }, | |
385 | { 1.1112333229323361, 0.60000000000000009, 1.0471975511965976, 0.0 }, | |
386 | { 1.3191461190365270, 0.60000000000000009, 1.2217304763960306, 0.0 }, | |
387 | { 1.5332022105084779, 0.60000000000000009, 1.3962634015954636, 0.0 }, | |
388 | { 1.7507538029157526, 0.60000000000000009, 1.5707963267948966, 0.0 }, | |
7c62b943 | 389 | }; |
b4688136 ESR |
390 | const double toler016 = 2.5000000000000020e-13; |
391 | ||
392 | // Test data for k=0.70000000000000018. | |
393 | // max(|f - f_Boost|): 6.6613381477509392e-16 at index 8 | |
394 | // max(|f - f_Boost| / |f_Boost|): 4.1569224977685422e-16 | |
395 | // mean(f - f_Boost): -1.1102230246251566e-17 | |
396 | // variance(f - f_Boost): 2.3145398087213714e-32 | |
397 | // stddev(f - f_Boost): 1.5213611697165703e-16 | |
398 | const testcase_ellint_1<double> | |
399 | data017[10] = | |
7c62b943 | 400 | { |
b4688136 ESR |
401 | { 0.0000000000000000, 0.70000000000000018, 0.0000000000000000, 0.0 }, |
402 | { 0.17496737466916723, 0.70000000000000018, 0.17453292519943295, 0.0 }, | |
403 | { 0.35254687535677931, 0.70000000000000018, 0.34906585039886590, 0.0 }, | |
404 | { 0.53536740275997130, 0.70000000000000018, 0.52359877559829882, 0.0 }, | |
405 | { 0.72603797651684454, 0.70000000000000018, 0.69813170079773179, 0.0 }, | |
406 | { 0.92698296348313447, 0.70000000000000018, 0.87266462599716477, 0.0 }, | |
407 | { 1.1400447527693318, 0.70000000000000018, 1.0471975511965976, 0.0 }, | |
408 | { 1.3657668117194073, 0.70000000000000018, 1.2217304763960306, 0.0 }, | |
409 | { 1.6024686895959164, 0.70000000000000018, 1.3962634015954636, 0.0 }, | |
410 | { 1.8456939983747236, 0.70000000000000018, 1.5707963267948966, 0.0 }, | |
7c62b943 | 411 | }; |
b4688136 | 412 | const double toler017 = 2.5000000000000020e-13; |
7c62b943 | 413 | |
b4688136 ESR |
414 | // Test data for k=0.80000000000000004. |
415 | // max(|f - f_Boost|): 8.8817841970012523e-16 at index 8 | |
416 | // max(|f - f_Boost| / |f_Boost|): 5.2032670495747184e-16 | |
417 | // mean(f - f_Boost): 1.9428902930940239e-16 | |
418 | // variance(f - f_Boost): 2.7486111305082033e-32 | |
419 | // stddev(f - f_Boost): 1.6578935823834422e-16 | |
420 | const testcase_ellint_1<double> | |
421 | data018[10] = | |
7c62b943 | 422 | { |
b4688136 ESR |
423 | { 0.0000000000000000, 0.80000000000000004, 0.0000000000000000, 0.0 }, |
424 | { 0.17510154241338899, 0.80000000000000004, 0.17453292519943295, 0.0 }, | |
425 | { 0.35365068839779396, 0.80000000000000004, 0.34906585039886590, 0.0 }, | |
426 | { 0.53926804409084550, 0.80000000000000004, 0.52359877559829882, 0.0 }, | |
427 | { 0.73587926028070372, 0.80000000000000004, 0.69813170079773179, 0.0 }, | |
428 | { 0.94770942970071170, 0.80000000000000004, 0.87266462599716477, 0.0 }, | |
429 | { 1.1789022995388236, 0.80000000000000004, 1.0471975511965976, 0.0 }, | |
430 | { 1.4323027881876012, 0.80000000000000004, 1.2217304763960306, 0.0 }, | |
431 | { 1.7069629739121677, 0.80000000000000004, 1.3962634015954636, 0.0 }, | |
432 | { 1.9953027776647294, 0.80000000000000004, 1.5707963267948966, 0.0 }, | |
7c62b943 | 433 | }; |
b4688136 ESR |
434 | const double toler018 = 2.5000000000000020e-13; |
435 | ||
436 | // Test data for k=0.90000000000000013. | |
437 | // max(|f - f_Boost|): 8.8817841970012523e-16 at index 9 | |
438 | // max(|f - f_Boost| / |f_Boost|): 4.3381508715713360e-16 | |
439 | // mean(f - f_Boost): 1.4710455076283324e-16 | |
440 | // variance(f - f_Boost): 6.7801293731072419e-32 | |
441 | // stddev(f - f_Boost): 2.6038681558610532e-16 | |
442 | const testcase_ellint_1<double> | |
443 | data019[10] = | |
7c62b943 | 444 | { |
b4688136 ESR |
445 | { 0.0000000000000000, 0.90000000000000013, 0.0000000000000000, 0.0 }, |
446 | { 0.17525427376115027, 0.90000000000000013, 0.17453292519943295, 0.0 }, | |
447 | { 0.35492464591297446, 0.90000000000000013, 0.34906585039886590, 0.0 }, | |
448 | { 0.54388221416157123, 0.90000000000000013, 0.52359877559829882, 0.0 }, | |
449 | { 0.74797400423532512, 0.90000000000000013, 0.69813170079773179, 0.0 }, | |
450 | { 0.97463898451966446, 0.90000000000000013, 0.87266462599716477, 0.0 }, | |
451 | { 1.2334463254523440, 0.90000000000000013, 1.0471975511965976, 0.0 }, | |
452 | { 1.5355247765594915, 0.90000000000000013, 1.2217304763960306, 0.0 }, | |
453 | { 1.8882928567775128, 0.90000000000000013, 1.3962634015954636, 0.0 }, | |
454 | { 2.2805491384227707, 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_1<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::tr1::ellint_1(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 | } | |
7c62b943 | 484 | |
b4688136 ESR |
485 | int |
486 | main() | |
7c62b943 | 487 | { |
b4688136 ESR |
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); | |
7c62b943 BK |
507 | return 0; |
508 | } |