]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/special_functions/21_sph_neumann/check_value.cc
Only run math special function tests for C++11 and later
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / special_functions / 21_sph_neumann / check_value.cc
1 // { dg-do run { target c++11 } }
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 // sph_neumann
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 n=0.
42 // max(|f - f_GSL|): 4.4408920985006262e-16
43 // max(|f - f_GSL| / |f_GSL|): 4.8209634107822837e-15
44 const testcase_sph_neumann<double>
45 data001[20] =
46 {
47 { -3.8756496868425789, 0, 0.25000000000000000 },
48 { -1.7551651237807455, 0, 0.50000000000000000 },
49 { -0.97558515849842786, 0, 0.75000000000000000 },
50 { -0.54030230586813977, 0, 1.0000000000000000 },
51 { -0.25225788991621495, 0, 1.2500000000000000 },
52 { -0.047158134445135273, 0, 1.5000000000000000 },
53 { 0.10185488894256690, 0, 1.7500000000000000 },
54 { 0.20807341827357120, 0, 2.0000000000000000 },
55 { 0.27918827676566177, 0, 2.2500000000000000 },
56 { 0.32045744621877348, 0, 2.5000000000000000 },
57 { 0.33610995586635040, 0, 2.7500000000000000 },
58 { 0.32999749886681512, 0, 3.0000000000000000 },
59 { 0.30588605417862963, 0, 3.2500000000000000 },
60 { 0.26755905351165610, 0, 3.5000000000000000 },
61 { 0.21881582862388288, 0, 3.7500000000000000 },
62 { 0.16341090521590299, 0, 4.0000000000000000 },
63 { 0.10496176233265714, 0, 4.2500000000000000 },
64 { 0.046843510984617719, 0, 4.5000000000000000 },
65 { -0.0079162427132582220, 0, 4.7500000000000000 },
66 { -0.056732437092645263, 0, 5.0000000000000000 },
67 };
68 const double toler001 = 2.5000000000000020e-13;
69
70 // Test data for n=1.
71 // max(|f - f_GSL|): 3.5527136788005009e-15
72 // max(|f - f_GSL| / |f_GSL|): 3.7472288263398607e-15
73 const testcase_sph_neumann<double>
74 data002[20] =
75 {
76 { -16.492214584388407, 1, 0.25000000000000000 },
77 { -4.4691813247698970, 1, 0.50000000000000000 },
78 { -2.2096318913623492, 1, 0.75000000000000000 },
79 { -1.3817732906760363, 1, 1.0000000000000000 },
80 { -0.96099400741744090, 1, 1.2500000000000000 },
81 { -0.69643541403279308, 1, 1.5000000000000000 },
82 { -0.50407489024649721, 1, 1.7500000000000000 },
83 { -0.35061200427605527, 1, 2.0000000000000000 },
84 { -0.22172663116544869, 1, 2.2500000000000000 },
85 { -0.11120587915407318, 1, 2.5000000000000000 },
86 { -0.016564013158538646, 1, 2.7500000000000000 },
87 { 0.062959163602315973, 1, 3.0000000000000000 },
88 { 0.12740959652576553, 1, 3.2500000000000000 },
89 { 0.17666922320036457, 1, 3.5000000000000000 },
90 { 0.21076723929766045, 1, 3.7500000000000000 },
91 { 0.23005335013095779, 1, 4.0000000000000000 },
92 { 0.23528261660264485, 1, 4.2500000000000000 },
93 { 0.22763858414438104, 1, 4.5000000000000000 },
94 { 0.20871085184465679, 1, 4.7500000000000000 },
95 { 0.18043836751409864, 1, 5.0000000000000000 },
96 };
97 const double toler002 = 2.5000000000000020e-13;
98
99 // Test data for n=2.
100 // max(|f - f_GSL|): 5.6843418860808015e-14
101 // max(|f - f_GSL| / |f_GSL|): 2.4702749396271158e-15
102 const testcase_sph_neumann<double>
103 data003[20] =
104 {
105 { -194.03092532581832, 2, 0.25000000000000000 },
106 { -25.059922824838637, 2, 0.50000000000000000 },
107 { -7.8629424069509692, 2, 0.75000000000000000 },
108 { -3.6050175661599688, 2, 1.0000000000000000 },
109 { -2.0541277278856431, 2, 1.2500000000000000 },
110 { -1.3457126936204509, 2, 1.5000000000000000 },
111 { -0.96598327222227631, 2, 1.7500000000000000 },
112 { -0.73399142468765399, 2, 2.0000000000000000 },
113 { -0.57482378498626008, 2, 2.2500000000000000 },
114 { -0.45390450120366133, 2, 2.5000000000000000 },
115 { -0.35417978840293796, 2, 2.7500000000000000 },
116 { -0.26703833526449916, 2, 3.0000000000000000 },
117 { -0.18827719584715374, 2, 3.2500000000000000 },
118 { -0.11612829076848646, 2, 3.5000000000000000 },
119 { -0.050202037185754500, 2, 3.7500000000000000 },
120 { 0.0091291073823153435, 2, 4.0000000000000000 },
121 { 0.061120084680974532, 2, 4.2500000000000000 },
122 { 0.10491554511163632, 2, 4.5000000000000000 },
123 { 0.13973362282567303, 2, 4.7500000000000000 },
124 { 0.16499545760110443, 2, 5.0000000000000000 },
125 };
126 const double toler003 = 2.5000000000000020e-13;
127
128 // Test data for n=5.
129 // max(|f - f_GSL|): 4.6566128730773926e-10
130 // max(|f - f_GSL| / |f_GSL|): 6.3451511503162099e-16
131 const testcase_sph_neumann<double>
132 data004[20] =
133 {
134 { -3884190.0626637731, 5, 0.25000000000000000 },
135 { -61327.563166980639, 5, 0.50000000000000000 },
136 { -5478.9529323190836, 5, 0.75000000000000000 },
137 { -999.44034339223640, 5, 1.0000000000000000 },
138 { -270.49720502942358, 5, 1.2500000000000000 },
139 { -94.236110085232468, 5, 1.5000000000000000 },
140 { -39.182827786584333, 5, 1.7500000000000000 },
141 { -18.591445311190984, 5, 2.0000000000000000 },
142 { -9.7821420203182274, 5, 2.2500000000000000 },
143 { -5.5991001548063233, 5, 2.5000000000000000 },
144 { -3.4400655233636823, 5, 2.7500000000000000 },
145 { -2.2470233284653904, 5, 3.0000000000000000 },
146 { -1.5491439945779160, 5, 3.2500000000000000 },
147 { -1.1205896325654248, 5, 3.5000000000000000 },
148 { -0.84592255605194844, 5, 3.7500000000000000 },
149 { -0.66280126645045878, 5, 4.0000000000000000 },
150 { -0.53589374436038528, 5, 4.2500000000000000 },
151 { -0.44430324229090551, 5, 4.5000000000000000 },
152 { -0.37520157232899892, 5, 4.7500000000000000 },
153 { -0.32046504674973919, 5, 5.0000000000000000 },
154 };
155 const double toler004 = 2.5000000000000020e-13;
156
157 // Test data for n=10.
158 // max(|f - f_GSL|): 0.50000000000000000
159 // max(|f - f_GSL| / |f_GSL|): 1.2712694703401436e-15
160 const testcase_sph_neumann<double>
161 data005[20] =
162 {
163 { -2750653598174213.5, 10, 0.25000000000000000 },
164 { -1349739281107.0554, 10, 0.50000000000000000 },
165 { -15733380424.953760, 10, 0.75000000000000000 },
166 { -672215008.25620842, 10, 1.0000000000000000 },
167 { -58607405.988679446, 10, 1.2500000000000000 },
168 { -8032728.8148234813, 10, 1.5000000000000000 },
169 { -1505955.5720640516, 10, 1.7500000000000000 },
170 { -355414.72008543846, 10, 2.0000000000000000 },
171 { -100086.80374425423, 10, 2.2500000000000000 },
172 { -32423.794085334419, 10, 2.5000000000000000 },
173 { -11772.863161809979, 10, 2.7500000000000000 },
174 { -4699.8591888113924, 10, 3.0000000000000000 },
175 { -2033.0183273853759, 10, 3.2500000000000000 },
176 { -942.19075028425493, 10, 3.5000000000000000 },
177 { -463.65206971202474, 10, 3.7500000000000000 },
178 { -240.53552987988931, 10, 4.0000000000000000 },
179 { -130.78478404631085, 10, 4.2500000000000000 },
180 { -74.170665501737531, 10, 4.5000000000000000 },
181 { -43.698249898184983, 10, 4.7500000000000000 },
182 { -26.656114405718711, 10, 5.0000000000000000 },
183 };
184 const double toler005 = 2.5000000000000020e-13;
185
186 // Test data for n=20.
187 // max(|f - f_GSL|): 2.9514790517935283e+20
188 // max(|f - f_GSL| / |f_GSL|): 1.9896573344672978e-15
189 const testcase_sph_neumann<double>
190 data006[20] =
191 {
192 { -1.4077591402542251e+36, 20, 0.25000000000000000 },
193 { -6.7288761838234712e+29, 20, 0.50000000000000000 },
194 { -1.3544611382105945e+26, 20, 0.75000000000000000 },
195 { -3.2395922185789833e+23, 20, 1.0000000000000000 },
196 { -3.0096416715953060e+21, 20, 1.2500000000000000 },
197 { -6.5999646851668173e+19, 20, 1.5000000000000000 },
198 { -2.6193364753070735e+18, 20, 1.7500000000000000 },
199 { -1.6054364928152224e+17, 20, 2.0000000000000000 },
200 { -13719071872797762., 20, 2.2500000000000000 },
201 { -1524247248298953.8, 20, 2.5000000000000000 },
202 { -209484650509384.06, 20, 2.7500000000000000 },
203 { -34327545666696.488, 20, 3.0000000000000000 },
204 { -6522260876203.3174, 20, 3.2500000000000000 },
205 { -1406018871897.2307, 20, 3.5000000000000000 },
206 { -338025193731.78882, 20, 3.7500000000000000 },
207 { -89381690326.018677, 20, 4.0000000000000000 },
208 { -25701805899.474934, 20, 4.2500000000000000 },
209 { -7961859734.2407761, 20, 4.5000000000000000 },
210 { -2636237230.0850010, 20, 4.7500000000000000 },
211 { -926795140.30575466, 20, 5.0000000000000000 },
212 };
213 const double toler006 = 2.5000000000000020e-13;
214
215 // Test data for n=50.
216 // max(|f - f_GSL|): 2.0859248397665138e+93
217 // max(|f - f_GSL| / |f_GSL|): 7.3237119407125301e-14
218 const testcase_sph_neumann<double>
219 data007[20] =
220 {
221 { -1.3823742808004061e+109, 50, 0.25000000000000000 },
222 { -6.1447912922121694e+93, 50, 0.50000000000000000 },
223 { -6.4348494908900529e+84, 50, 0.75000000000000000 },
224 { -2.7391922846297569e+78, 50, 1.0000000000000000 },
225 { -3.1365037573299931e+73, 50, 1.2500000000000000 },
226 { -2.8821098528635756e+69, 50, 1.5000000000000000 },
227 { -1.1148255024189452e+66, 50, 1.7500000000000000 },
228 { -1.2350219443670970e+63, 50, 2.0000000000000000 },
229 { -3.0565226939717125e+60, 50, 2.2500000000000000 },
230 { -1.4262702131152733e+58, 50, 2.5000000000000000 },
231 { -1.1118745474840939e+56, 50, 2.7500000000000000 },
232 { -1.3243260716629126e+54, 50, 3.0000000000000000 },
233 { -2.2519472094129334e+52, 50, 3.2500000000000000 },
234 { -5.1861507201100364e+50, 50, 3.5000000000000000 },
235 { -1.5513212909461383e+49, 50, 3.7500000000000000 },
236 { -5.8276471407899822e+47, 50, 4.0000000000000000 },
237 { -2.6745414086542661e+46, 50, 4.2500000000000000 },
238 { -1.4657308996352322e+45, 50, 4.5000000000000000 },
239 { -9.4102674366685358e+43, 50, 4.7500000000000000 },
240 { -6.9641091882698388e+42, 50, 5.0000000000000000 },
241 };
242 const double toler007 = 5.0000000000000029e-12;
243
244 // Test data for n=100.
245 // max(|f - f_GSL|): 2.4840289476811343e+232
246 // max(|f - f_GSL| / |f_GSL|): 9.0555289224453335e-14
247 const testcase_sph_neumann<double>
248 data008[20] =
249 {
250 { -4.2856109460516407e+247, 100, 0.25000000000000000 },
251 { -1.6911720011753781e+217, 100, 0.50000000000000000 },
252 { -2.7753107402139484e+199, 100, 0.75000000000000000 },
253 { -6.6830794632586774e+186, 100, 1.0000000000000000 },
254 { -1.0906342369729277e+177, 100, 1.2500000000000000 },
255 { -1.0993184254131119e+169, 100, 1.5000000000000000 },
256 { -1.9071480498141315e+162, 100, 1.7500000000000000 },
257 { -2.6559558301924957e+156, 100, 2.0000000000000000 },
258 { -1.8154136926485787e+151, 100, 2.2500000000000000 },
259 { -4.3527631662111383e+146, 100, 2.5000000000000000 },
260 { -2.8809537014100589e+142, 100, 2.7500000000000000 },
261 { -4.4102229953033134e+138, 100, 3.0000000000000000 },
262 { -1.3651904154045514e+135, 100, 3.2500000000000000 },
263 { -7.6980749101080730e+131, 100, 3.5000000000000000 },
264 { -7.2790553499254927e+128, 100, 3.7500000000000000 },
265 { -1.0796647795893970e+126, 100, 4.0000000000000000 },
266 { -2.3785795774445298e+123, 100, 4.2500000000000000 },
267 { -7.4391596631955861e+120, 100, 4.5000000000000000 },
268 { -3.1802258278279400e+118, 100, 4.7500000000000000 },
269 { -1.7997139826259740e+116, 100, 5.0000000000000000 },
270 };
271 const double toler008 = 5.0000000000000029e-12;
272 // sph_neumann
273
274 // Test data for n=0.
275 // max(|f - f_GSL|): 1.0165479569224090e-15
276 // max(|f - f_GSL| / |f_GSL|): 5.9073915926662418e-13
277 const testcase_sph_neumann<double>
278 data009[20] =
279 {
280 { -0.056732437092645263, 0, 5.0000000000000000 },
281 { 0.083907152907645249, 0, 10.000000000000000 },
282 { 0.050645860857254747, 0, 15.000000000000000 },
283 { -0.020404103090669597, 0, 20.000000000000000 },
284 { -0.039648112474538942, 0, 25.000000000000000 },
285 { -0.0051417149962528020, 0, 30.000000000000000 },
286 { 0.025819777288328762, 0, 35.000000000000000 },
287 { 0.016673451541306544, 0, 40.000000000000000 },
288 { -0.011673821973727327, 0, 45.000000000000000 },
289 { -0.019299320569842265, 0, 50.000000000000000 },
290 { -0.00040230465930828606, 0, 55.000000000000000 },
291 { 0.015873549673585938, 0, 60.000000000000000 },
292 { 0.0086531361728949541, 0, 65.000000000000000 },
293 { -0.0090474171869471404, 0, 70.000000000000000 },
294 { -0.012290016929663325, 0, 75.000000000000000 },
295 { 0.0013798405479880944, 0, 80.000000000000000 },
296 { 0.011580901686988727, 0, 85.000000000000000 },
297 { 0.0049785957347685574, 0, 90.000000000000000 },
298 { -0.0076860374841559963, 0, 95.000000000000000 },
299 { -0.0086231887228768404, 0, 100.00000000000000 },
300 };
301 const double toler009 = 5.0000000000000028e-11;
302
303 // Test data for n=1.
304 // max(|f - f_GSL|): 1.0529771499179219e-15
305 // max(|f - f_GSL| / |f_GSL|): 3.5182047773188613e-13
306 const testcase_sph_neumann<double>
307 data010[20] =
308 {
309 { 0.18043836751409864, 1, 5.0000000000000000 },
310 { 0.062792826379701502, 1, 10.000000000000000 },
311 { -0.039976131953324147, 1, 15.000000000000000 },
312 { -0.046667467690914864, 1, 20.000000000000000 },
313 { 0.0037081455049293634, 1, 25.000000000000000 },
314 { 0.032762996969886965, 1, 30.000000000000000 },
315 { 0.012971498479556563, 1, 35.000000000000000 },
316 { -0.018210992723451058, 1, 40.000000000000000 },
317 { -0.019168385477952129, 1, 45.000000000000000 },
318 { 0.0048615106626817301, 1, 50.000000000000000 },
319 { 0.018170052158169303, 1, 55.000000000000000 },
320 { 0.0053447361795967109, 1, 60.000000000000000 },
321 { -0.012587316051033977, 1, 65.000000000000000 },
322 { -0.011184829982069090, 1, 70.000000000000000 },
323 { 0.0050065549130635621, 1, 75.000000000000000 },
324 { 0.012440856180892041, 1, 80.000000000000000 },
325 { 0.0022077237839479508, 1, 85.000000000000000 },
326 { -0.0098779785318421041, 1, 90.000000000000000 },
327 { -0.0072731342338976518, 1, 95.000000000000000 },
328 { 0.0049774245238688201, 1, 100.00000000000000 },
329 };
330 const double toler010 = 2.5000000000000014e-11;
331
332 // Test data for n=2.
333 // max(|f - f_GSL|): 9.7144514654701197e-16
334 // max(|f - f_GSL| / |f_GSL|): 8.9389761338979581e-13
335 const testcase_sph_neumann<double>
336 data011[20] =
337 {
338 { 0.16499545760110443, 2, 5.0000000000000000 },
339 { -0.065069304993734783, 2, 10.000000000000000 },
340 { -0.058641087247919575, 2, 15.000000000000000 },
341 { 0.013403982937032370, 2, 20.000000000000000 },
342 { 0.040093089935130458, 2, 25.000000000000000 },
343 { 0.0084180146932414986, 2, 30.000000000000000 },
344 { -0.024707934561509628, 2, 35.000000000000000 },
345 { -0.018039275995565374, 2, 40.000000000000000 },
346 { 0.010395929608530518, 2, 45.000000000000000 },
347 { 0.019591011209603170, 2, 50.000000000000000 },
348 { 0.0013933984133902479, 2, 55.000000000000000 },
349 { -0.015606312864606101, 2, 60.000000000000000 },
350 { -0.0092340892214042153, 2, 65.000000000000000 },
351 { 0.0085680673305727519, 2, 70.000000000000000 },
352 { 0.012490279126185866, 2, 75.000000000000000 },
353 { -0.00091330844120464274, 2, 80.000000000000000 },
354 { -0.011502982024025860, 2, 85.000000000000000 },
355 { -0.0053078616858299611, 2, 90.000000000000000 },
356 { 0.0074563595609802797, 2, 95.000000000000000 },
357 { 0.0087725114585929052, 2, 100.00000000000000 },
358 };
359 const double toler011 = 5.0000000000000028e-11;
360
361 // Test data for n=5.
362 // max(|f - f_GSL|): 1.1327744298128550e-15
363 // max(|f - f_GSL| / |f_GSL|): 6.2024335299315527e-13
364 const testcase_sph_neumann<double>
365 data012[20] =
366 {
367 { -0.32046504674973919, 5, 5.0000000000000000 },
368 { 0.093833541678691818, 5, 10.000000000000000 },
369 { 0.020475698281859061, 5, 15.000000000000000 },
370 { -0.048172347757372780, 5, 20.000000000000000 },
371 { -0.018309489232548347, 5, 25.000000000000000 },
372 { 0.026639390496569996, 5, 30.000000000000000 },
373 { 0.022006038985576210, 5, 35.000000000000000 },
374 { -0.011268975348057965, 5, 40.000000000000000 },
375 { -0.021770388372274858, 5, 45.000000000000000 },
376 { -0.00069711319645853701, 5, 50.000000000000000 },
377 { 0.017439589450220901, 5, 55.000000000000000 },
378 { 0.0088699170919343089, 5, 60.000000000000000 },
379 { -0.010421334444951861, 5, 65.000000000000000 },
380 { -0.012746769858008553, 5, 70.000000000000000 },
381 { 0.0026282888028967737, 5, 75.000000000000000 },
382 { 0.012477658581324189, 5, 80.000000000000000 },
383 { 0.0040771816818182642, 5, 85.000000000000000 },
384 { -0.0089777759570579818, 5, 90.000000000000000 },
385 { -0.0083184557896676149, 5, 95.000000000000000 },
386 { 0.0037206784862748965, 5, 100.00000000000000 },
387 };
388 const double toler012 = 5.0000000000000028e-11;
389
390 // Test data for n=10.
391 // max(|f - f_GSL|): 1.0658141036401503e-14
392 // max(|f - f_GSL| / |f_GSL|): 7.3655649039219020e-13
393 const testcase_sph_neumann<double>
394 data013[20] =
395 {
396 { -26.656114405718711, 10, 5.0000000000000000 },
397 { -0.17245367208805784, 10, 10.000000000000000 },
398 { 0.078461689849642580, 10, 15.000000000000000 },
399 { -0.036843410496289961, 10, 20.000000000000000 },
400 { -0.021158339301097475, 10, 25.000000000000000 },
401 { 0.031219591064754939, 10, 30.000000000000000 },
402 { 0.012840593422414807, 10, 35.000000000000000 },
403 { -0.021803068636888072, 10, 40.000000000000000 },
404 { -0.014071636804469044, 10, 45.000000000000000 },
405 { 0.013524687511158758, 10, 50.000000000000000 },
406 { 0.015684932653180595, 10, 55.000000000000000 },
407 { -0.0056356895567262122, 10, 60.000000000000000 },
408 { -0.015364490270315362, 10, 65.000000000000000 },
409 { -0.0014525575672261295, 10, 70.000000000000000 },
410 { 0.012648951699549433, 10, 75.000000000000000 },
411 { 0.0068571608061120367, 10, 80.000000000000000 },
412 { -0.0080151152941401460, 10, 85.000000000000000 },
413 { -0.0098139742219019149, 10, 90.000000000000000 },
414 { 0.0025002854072314951, 10, 95.000000000000000 },
415 { 0.010025777373636155, 10, 100.00000000000000 },
416 };
417 const double toler013 = 5.0000000000000028e-11;
418
419 // Test data for n=20.
420 // max(|f - f_GSL|): 1.0728836059570312e-06
421 // max(|f - f_GSL| / |f_GSL|): 1.0496253232407487e-11
422 const testcase_sph_neumann<double>
423 data014[20] =
424 {
425 { -926795140.30575466, 20, 5.0000000000000000 },
426 { -1211.2106053526036, 20, 10.000000000000000 },
427 { -1.5559965765652175, 20, 15.000000000000000 },
428 { -0.093401132250914398, 20, 20.000000000000000 },
429 { 0.044031985675276462, 20, 25.000000000000000 },
430 { -0.036078033606613907, 20, 30.000000000000000 },
431 { 0.029828405631319645, 20, 35.000000000000000 },
432 { -0.0048414810986760759, 20, 40.000000000000000 },
433 { -0.020504694681516944, 20, 45.000000000000000 },
434 { 0.013759531302541216, 20, 50.000000000000000 },
435 { 0.012783038861734196, 20, 55.000000000000000 },
436 { -0.013117009421906418, 20, 60.000000000000000 },
437 { -0.010338106075674407, 20, 65.000000000000000 },
438 { 0.010538610814111244, 20, 70.000000000000000 },
439 { 0.010200029094273744, 20, 75.000000000000000 },
440 { -0.0073123450945617122, 20, 80.000000000000000 },
441 { -0.010581510354950906, 20, 85.000000000000000 },
442 { 0.0036866374015298723, 20, 90.000000000000000 },
443 { 0.010498384318338270, 20, 95.000000000000000 },
444 { 5.6317293788334978e-05, 20, 100.00000000000000 },
445 };
446 const double toler014 = 1.0000000000000007e-09;
447
448 // Test data for n=50.
449 // max(|f - f_GSL|): 5.1003129618557667e+29
450 // max(|f - f_GSL| / |f_GSL|): 4.9443320929884463e-13
451 const testcase_sph_neumann<double>
452 data015[20] =
453 {
454 { -6.9641091882698388e+42, 50, 5.0000000000000000 },
455 { -4.5282272723512023e+27, 50, 10.000000000000000 },
456 { -9.0004902645887037e+18, 50, 15.000000000000000 },
457 { -9542541667002.5117, 50, 20.000000000000000 },
458 { -363518140.71026671, 50, 25.000000000000000 },
459 { -152551.57233157745, 50, 30.000000000000000 },
460 { -386.26599186208625, 50, 35.000000000000000 },
461 { -4.3290507947291035, 50, 40.000000000000000 },
462 { -0.19968460851503758, 50, 45.000000000000000 },
463 { -0.041900001504607758, 50, 50.000000000000000 },
464 { 0.010696040672421902, 50, 55.000000000000000 },
465 { 0.0078198768555267188, 50, 60.000000000000000 },
466 { -0.010088474938191242, 50, 65.000000000000000 },
467 { 0.0062423671279824801, 50, 70.000000000000000 },
468 { 0.0011284242794941733, 50, 75.000000000000000 },
469 { -0.0093934266037485562, 50, 80.000000000000000 },
470 { 0.013108079602843424, 50, 85.000000000000000 },
471 { -0.0075396607225722626, 50, 90.000000000000000 },
472 { -0.0042605703552836558, 50, 95.000000000000000 },
473 { 0.010747822973682470, 50, 100.00000000000000 },
474 };
475 const double toler015 = 2.5000000000000014e-11;
476
477 // Test data for n=100.
478 // max(|f - f_GSL|): 3.0796490204944808e+102
479 // max(|f - f_GSL| / |f_GSL|): 4.6209003006798690e-14
480 const testcase_sph_neumann<double>
481 data016[20] =
482 {
483 { -1.7997139826259740e+116, 100, 5.0000000000000000 },
484 { -8.5732263093296268e+85, 100, 10.000000000000000 },
485 { -1.9270658593711677e+68, 100, 15.000000000000000 },
486 { -7.2208893582952385e+55, 100, 20.000000000000000 },
487 { -2.0868752613007946e+46, 100, 25.000000000000000 },
488 { -4.2496124023612646e+38, 100, 30.000000000000000 },
489 { -1.7042898348910271e+32, 100, 35.000000000000000 },
490 { -6.3021565260724554e+26, 100, 40.000000000000000 },
491 { -1.3199917400494367e+22, 100, 45.000000000000000 },
492 { -1.1256928913265988e+18, 100, 50.000000000000000 },
493 { -309801083340343.25, 100, 55.000000000000000 },
494 { -232585620046.64737, 100, 60.000000000000000 },
495 { -421135935.93756074, 100, 65.000000000000000 },
496 { -1680637.4531202621, 100, 70.000000000000000 },
497 { -13868.302591128844, 100, 75.000000000000000 },
498 { -227.24385709173322, 100, 80.000000000000000 },
499 { -7.2807038787138731, 100, 85.000000000000000 },
500 { -0.46648154448250878, 100, 90.000000000000000 },
501 { -0.067270772720654556, 100, 95.000000000000000 },
502 { -0.022983850491562267, 100, 100.00000000000000 },
503 };
504 const double toler016 = 2.5000000000000015e-12;
505
506 template<typename Tp, unsigned int Num>
507 void
508 test(const testcase_sph_neumann<Tp> (&data)[Num], Tp toler)
509 {
510 bool test __attribute__((unused)) = true;
511 const Tp eps = std::numeric_limits<Tp>::epsilon();
512 Tp max_abs_diff = -Tp(1);
513 Tp max_abs_frac = -Tp(1);
514 unsigned int num_datum = Num;
515 for (unsigned int i = 0; i < num_datum; ++i)
516 {
517 const Tp f = std::sph_neumann(data[i].n, data[i].x);
518 const Tp f0 = data[i].f0;
519 const Tp diff = f - f0;
520 if (std::abs(diff) > max_abs_diff)
521 max_abs_diff = std::abs(diff);
522 if (std::abs(f0) > Tp(10) * eps
523 && std::abs(f) > Tp(10) * eps)
524 {
525 const Tp frac = diff / f0;
526 if (std::abs(frac) > max_abs_frac)
527 max_abs_frac = std::abs(frac);
528 }
529 }
530 VERIFY(max_abs_frac < toler);
531 }
532
533 int
534 main()
535 {
536 test(data001, toler001);
537 test(data002, toler002);
538 test(data003, toler003);
539 test(data004, toler004);
540 test(data005, toler005);
541 test(data006, toler006);
542 test(data007, toler007);
543 test(data008, toler008);
544 test(data009, toler009);
545 test(data010, toler010);
546 test(data011, toler011);
547 test(data012, toler012);
548 test(data013, toler013);
549 test(data014, toler014);
550 test(data015, toler015);
551 test(data016, toler016);
552 return 0;
553 }