]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/special_functions/21_sph_neumann/check_value.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / special_functions / 21_sph_neumann / check_value.cc
CommitLineData
196c9e7a 1// { dg-do run { target c++11 } }
2be75957
ESR
2// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
3//
83ffe9cd 4// Copyright (C) 2016-2023 Free Software Foundation, Inc.
2be75957
ESR
5//
6// This file is part of the GNU ISO C++ Library. This library is free
7// software; you can redistribute it and/or modify it under the
8// terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 3, or (at your option)
10// any later version.
11//
12// This library is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License along
18// with this library; see the file COPYING3. If not see
19// <http://www.gnu.org/licenses/>.
20
21// 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
2be75957 40// Test data for n=0.
b4688136
ESR
41// max(|f - f_GSL|): 1.3322676295501878e-15 at index 0
42// max(|f - f_GSL| / |f_GSL|): 6.3549063142130099e-15
43// mean(f - f_GSL): 1.5525775109992422e-17
44// variance(f - f_GSL): 1.8100648852545731e-34
45// stddev(f - f_GSL): 1.3453865189062112e-17
2be75957
ESR
46const testcase_sph_neumann<double>
47data001[20] =
48{
b4688136
ESR
49 { -3.8756496868425789, 0, 0.25000000000000000, 0.0 },
50 { -1.7551651237807455, 0, 0.50000000000000000, 0.0 },
51 { -0.97558515849842786, 0, 0.75000000000000000, 0.0 },
52 { -0.54030230586813977, 0, 1.0000000000000000, 0.0 },
53 { -0.25225788991621495, 0, 1.2500000000000000, 0.0 },
54 { -0.047158134445135273, 0, 1.5000000000000000, 0.0 },
55 { 0.10185488894256690, 0, 1.7500000000000000, 0.0 },
56 { 0.20807341827357120, 0, 2.0000000000000000, 0.0 },
57 { 0.27918827676566177, 0, 2.2500000000000000, 0.0 },
58 { 0.32045744621877348, 0, 2.5000000000000000, 0.0 },
59 { 0.33610995586635040, 0, 2.7500000000000000, 0.0 },
60 { 0.32999749886681512, 0, 3.0000000000000000, 0.0 },
61 { 0.30588605417862963, 0, 3.2500000000000000, 0.0 },
62 { 0.26755905351165610, 0, 3.5000000000000000, 0.0 },
63 { 0.21881582862388288, 0, 3.7500000000000000, 0.0 },
64 { 0.16341090521590299, 0, 4.0000000000000000, 0.0 },
65 { 0.10496176233265714, 0, 4.2500000000000000, 0.0 },
66 { 0.046843510984617719, 0, 4.5000000000000000, 0.0 },
67 { -0.0079162427132582220, 0, 4.7500000000000000, 0.0 },
68 { -0.056732437092645263, 0, 5.0000000000000000, 0.0 },
2be75957 69};
b4688136 70const double toler001 = 5.0000000000000039e-13;
2be75957
ESR
71
72// Test data for n=1.
b4688136
ESR
73// max(|f - f_GSL|): 3.5527136788005009e-15 at index 0
74// max(|f - f_GSL| / |f_GSL|): 5.0269657509879036e-15
75// mean(f - f_GSL): -2.8727020762175924e-16
76// variance(f - f_GSL): 4.5719762984514500e-33
77// stddev(f - f_GSL): 6.7616390752919144e-17
2be75957
ESR
78const testcase_sph_neumann<double>
79data002[20] =
80{
b4688136
ESR
81 { -16.492214584388407, 1, 0.25000000000000000, 0.0 },
82 { -4.4691813247698970, 1, 0.50000000000000000, 0.0 },
83 { -2.2096318913623492, 1, 0.75000000000000000, 0.0 },
84 { -1.3817732906760363, 1, 1.0000000000000000, 0.0 },
85 { -0.96099400741744090, 1, 1.2500000000000000, 0.0 },
86 { -0.69643541403279308, 1, 1.5000000000000000, 0.0 },
87 { -0.50407489024649721, 1, 1.7500000000000000, 0.0 },
88 { -0.35061200427605527, 1, 2.0000000000000000, 0.0 },
89 { -0.22172663116544869, 1, 2.2500000000000000, 0.0 },
90 { -0.11120587915407318, 1, 2.5000000000000000, 0.0 },
91 { -0.016564013158538646, 1, 2.7500000000000000, 0.0 },
92 { 0.062959163602315973, 1, 3.0000000000000000, 0.0 },
93 { 0.12740959652576553, 1, 3.2500000000000000, 0.0 },
94 { 0.17666922320036457, 1, 3.5000000000000000, 0.0 },
95 { 0.21076723929766045, 1, 3.7500000000000000, 0.0 },
96 { 0.23005335013095779, 1, 4.0000000000000000, 0.0 },
97 { 0.23528261660264485, 1, 4.2500000000000000, 0.0 },
98 { 0.22763858414438104, 1, 4.5000000000000000, 0.0 },
99 { 0.20871085184465679, 1, 4.7500000000000000, 0.0 },
100 { 0.18043836751409864, 1, 5.0000000000000000, 0.0 },
2be75957 101};
b4688136 102const double toler002 = 5.0000000000000039e-13;
2be75957
ESR
103
104// Test data for n=2.
b4688136
ESR
105// max(|f - f_GSL|): 1.0658141036401503e-14 at index 1
106// max(|f - f_GSL| / |f_GSL|): 1.4758752580536458e-15
107// mean(f - f_GSL): -7.2060413192076563e-16
108// variance(f - f_GSL): 3.1027271571410419e-32
109// stddev(f - f_GSL): 1.7614559764981474e-16
2be75957
ESR
110const testcase_sph_neumann<double>
111data003[20] =
112{
b4688136
ESR
113 { -194.03092532581832, 2, 0.25000000000000000, 0.0 },
114 { -25.059922824838637, 2, 0.50000000000000000, 0.0 },
115 { -7.8629424069509692, 2, 0.75000000000000000, 0.0 },
116 { -3.6050175661599688, 2, 1.0000000000000000, 0.0 },
117 { -2.0541277278856431, 2, 1.2500000000000000, 0.0 },
118 { -1.3457126936204509, 2, 1.5000000000000000, 0.0 },
119 { -0.96598327222227631, 2, 1.7500000000000000, 0.0 },
120 { -0.73399142468765399, 2, 2.0000000000000000, 0.0 },
121 { -0.57482378498626008, 2, 2.2500000000000000, 0.0 },
122 { -0.45390450120366133, 2, 2.5000000000000000, 0.0 },
123 { -0.35417978840293796, 2, 2.7500000000000000, 0.0 },
124 { -0.26703833526449916, 2, 3.0000000000000000, 0.0 },
125 { -0.18827719584715374, 2, 3.2500000000000000, 0.0 },
126 { -0.11612829076848646, 2, 3.5000000000000000, 0.0 },
127 { -0.050202037185754500, 2, 3.7500000000000000, 0.0 },
128 { 0.0091291073823153435, 2, 4.0000000000000000, 0.0 },
129 { 0.061120084680974532, 2, 4.2500000000000000, 0.0 },
130 { 0.10491554511163632, 2, 4.5000000000000000, 0.0 },
131 { 0.13973362282567303, 2, 4.7500000000000000, 0.0 },
132 { 0.16499545760110443, 2, 5.0000000000000000, 0.0 },
2be75957
ESR
133};
134const double toler003 = 2.5000000000000020e-13;
135
136// Test data for n=5.
b4688136
ESR
137// max(|f - f_GSL|): 4.6566128730773926e-10 at index 0
138// max(|f - f_GSL| / |f_GSL|): 7.9314389378952617e-16
139// mean(f - f_GSL): -2.3717425245983749e-11
140// variance(f - f_GSL): 3.1164189869182792e-23
141// stddev(f - f_GSL): 5.5824895762717548e-12
2be75957
ESR
142const testcase_sph_neumann<double>
143data004[20] =
144{
b4688136
ESR
145 { -3884190.0626637731, 5, 0.25000000000000000, 0.0 },
146 { -61327.563166980639, 5, 0.50000000000000000, 0.0 },
147 { -5478.9529323190836, 5, 0.75000000000000000, 0.0 },
148 { -999.44034339223640, 5, 1.0000000000000000, 0.0 },
149 { -270.49720502942358, 5, 1.2500000000000000, 0.0 },
150 { -94.236110085232468, 5, 1.5000000000000000, 0.0 },
151 { -39.182827786584333, 5, 1.7500000000000000, 0.0 },
152 { -18.591445311190984, 5, 2.0000000000000000, 0.0 },
153 { -9.7821420203182274, 5, 2.2500000000000000, 0.0 },
154 { -5.5991001548063233, 5, 2.5000000000000000, 0.0 },
155 { -3.4400655233636823, 5, 2.7500000000000000, 0.0 },
156 { -2.2470233284653904, 5, 3.0000000000000000, 0.0 },
157 { -1.5491439945779160, 5, 3.2500000000000000, 0.0 },
158 { -1.1205896325654248, 5, 3.5000000000000000, 0.0 },
159 { -0.84592255605194844, 5, 3.7500000000000000, 0.0 },
160 { -0.66280126645045878, 5, 4.0000000000000000, 0.0 },
161 { -0.53589374436038528, 5, 4.2500000000000000, 0.0 },
162 { -0.44430324229090551, 5, 4.5000000000000000, 0.0 },
163 { -0.37520157232899892, 5, 4.7500000000000000, 0.0 },
164 { -0.32046504674973919, 5, 5.0000000000000000, 0.0 },
2be75957
ESR
165};
166const double toler004 = 2.5000000000000020e-13;
167
168// Test data for n=10.
b4688136
ESR
169// max(|f - f_GSL|): 0.50000000000000000 at index 0
170// max(|f - f_GSL| / |f_GSL|): 1.5255233644081723e-15
171// mean(f - f_GSL): -0.025048278210168286
172// variance(f - f_GSL): 3.4761477272673221e-05
173// stddev(f - f_GSL): 0.0058958864704701719
2be75957
ESR
174const testcase_sph_neumann<double>
175data005[20] =
176{
b4688136
ESR
177 { -2750653598174213.5, 10, 0.25000000000000000, 0.0 },
178 { -1349739281107.0554, 10, 0.50000000000000000, 0.0 },
179 { -15733380424.953760, 10, 0.75000000000000000, 0.0 },
180 { -672215008.25620842, 10, 1.0000000000000000, 0.0 },
181 { -58607405.988679446, 10, 1.2500000000000000, 0.0 },
182 { -8032728.8148234813, 10, 1.5000000000000000, 0.0 },
183 { -1505955.5720640516, 10, 1.7500000000000000, 0.0 },
184 { -355414.72008543846, 10, 2.0000000000000000, 0.0 },
185 { -100086.80374425423, 10, 2.2500000000000000, 0.0 },
186 { -32423.794085334419, 10, 2.5000000000000000, 0.0 },
187 { -11772.863161809979, 10, 2.7500000000000000, 0.0 },
188 { -4699.8591888113924, 10, 3.0000000000000000, 0.0 },
189 { -2033.0183273853759, 10, 3.2500000000000000, 0.0 },
190 { -942.19075028425493, 10, 3.5000000000000000, 0.0 },
191 { -463.65206971202474, 10, 3.7500000000000000, 0.0 },
192 { -240.53552987988931, 10, 4.0000000000000000, 0.0 },
193 { -130.78478404631085, 10, 4.2500000000000000, 0.0 },
194 { -74.170665501737531, 10, 4.5000000000000000, 0.0 },
195 { -43.698249898184983, 10, 4.7500000000000000, 0.0 },
196 { -26.656114405718711, 10, 5.0000000000000000, 0.0 },
2be75957
ESR
197};
198const double toler005 = 2.5000000000000020e-13;
199
200// Test data for n=20.
b4688136
ESR
201// max(|f - f_GSL|): 2.9514790517935283e+20 at index 0
202// max(|f - f_GSL| / |f_GSL|): 2.1705352739643247e-15
203// mean(f - f_GSL): -1.4757416361014618e+19
204// variance(f - f_GSL): inf
205// stddev(f - f_GSL): inf
2be75957
ESR
206const testcase_sph_neumann<double>
207data006[20] =
208{
b4688136
ESR
209 { -1.4077591402542251e+36, 20, 0.25000000000000000, 0.0 },
210 { -6.7288761838234712e+29, 20, 0.50000000000000000, 0.0 },
211 { -1.3544611382105945e+26, 20, 0.75000000000000000, 0.0 },
212 { -3.2395922185789833e+23, 20, 1.0000000000000000, 0.0 },
213 { -3.0096416715953060e+21, 20, 1.2500000000000000, 0.0 },
214 { -6.5999646851668173e+19, 20, 1.5000000000000000, 0.0 },
215 { -2.6193364753070735e+18, 20, 1.7500000000000000, 0.0 },
216 { -1.6054364928152224e+17, 20, 2.0000000000000000, 0.0 },
217 { -13719071872797762., 20, 2.2500000000000000, 0.0 },
218 { -1524247248298953.8, 20, 2.5000000000000000, 0.0 },
219 { -209484650509384.06, 20, 2.7500000000000000, 0.0 },
220 { -34327545666696.488, 20, 3.0000000000000000, 0.0 },
221 { -6522260876203.3174, 20, 3.2500000000000000, 0.0 },
222 { -1406018871897.2307, 20, 3.5000000000000000, 0.0 },
223 { -338025193731.78882, 20, 3.7500000000000000, 0.0 },
224 { -89381690326.018677, 20, 4.0000000000000000, 0.0 },
225 { -25701805899.474934, 20, 4.2500000000000000, 0.0 },
226 { -7961859734.2407761, 20, 4.5000000000000000, 0.0 },
227 { -2636237230.0850010, 20, 4.7500000000000000, 0.0 },
228 { -926795140.30575466, 20, 5.0000000000000000, 0.0 },
2be75957
ESR
229};
230const double toler006 = 2.5000000000000020e-13;
231
232// Test data for n=50.
b4688136
ESR
233// max(|f - f_GSL|): 2.0859248397665138e+93 at index 0
234// max(|f - f_GSL| / |f_GSL|): 4.2498516526709979e-14
235// mean(f - f_GSL): 1.0429624198832546e+92
236// variance(f - f_GSL): inf
237// stddev(f - f_GSL): inf
2be75957
ESR
238const testcase_sph_neumann<double>
239data007[20] =
240{
b4688136
ESR
241 { -1.3823742808004061e+109, 50, 0.25000000000000000, 0.0 },
242 { -6.1447912922121694e+93, 50, 0.50000000000000000, 0.0 },
243 { -6.4348494908900529e+84, 50, 0.75000000000000000, 0.0 },
244 { -2.7391922846297569e+78, 50, 1.0000000000000000, 0.0 },
245 { -3.1365037573299931e+73, 50, 1.2500000000000000, 0.0 },
246 { -2.8821098528635756e+69, 50, 1.5000000000000000, 0.0 },
247 { -1.1148255024189452e+66, 50, 1.7500000000000000, 0.0 },
248 { -1.2350219443670970e+63, 50, 2.0000000000000000, 0.0 },
249 { -3.0565226939717125e+60, 50, 2.2500000000000000, 0.0 },
250 { -1.4262702131152733e+58, 50, 2.5000000000000000, 0.0 },
251 { -1.1118745474840939e+56, 50, 2.7500000000000000, 0.0 },
252 { -1.3243260716629503e+54, 50, 3.0000000000000000, 0.0 },
253 { -2.2519472094129329e+52, 50, 3.2500000000000000, 0.0 },
254 { -5.1861507201103288e+50, 50, 3.5000000000000000, 0.0 },
255 { -1.5513212909462263e+49, 50, 3.7500000000000000, 0.0 },
256 { -5.8276471407900649e+47, 50, 4.0000000000000000, 0.0 },
257 { -2.6745414086543416e+46, 50, 4.2500000000000000, 0.0 },
258 { -1.4657308996352946e+45, 50, 4.5000000000000000, 0.0 },
259 { -9.4102674366690647e+43, 50, 4.7500000000000000, 0.0 },
260 { -6.9641091882701322e+42, 50, 5.0000000000000000, 0.0 },
2be75957 261};
b4688136 262const double toler007 = 2.5000000000000015e-12;
2be75957
ESR
263
264// Test data for n=100.
b4688136
ESR
265// max(|f - f_GSL|): 2.4840289476811343e+232 at index 0
266// max(|f - f_GSL| / |f_GSL|): 2.1411436945786310e-13
267// mean(f - f_GSL): 1.2420144738405672e+231
268// variance(f - f_GSL): inf
269// stddev(f - f_GSL): inf
2be75957
ESR
270const testcase_sph_neumann<double>
271data008[20] =
272{
b4688136
ESR
273 { -4.2856109460516407e+247, 100, 0.25000000000000000, 0.0 },
274 { -1.6911720011753781e+217, 100, 0.50000000000000000, 0.0 },
275 { -2.7753107402139484e+199, 100, 0.75000000000000000, 0.0 },
276 { -6.6830794632586774e+186, 100, 1.0000000000000000, 0.0 },
277 { -1.0906342369729277e+177, 100, 1.2500000000000000, 0.0 },
278 { -1.0993184254131119e+169, 100, 1.5000000000000000, 0.0 },
279 { -1.9071480498141315e+162, 100, 1.7500000000000000, 0.0 },
280 { -2.6559558301924957e+156, 100, 2.0000000000000000, 0.0 },
281 { -1.8154136926485787e+151, 100, 2.2500000000000000, 0.0 },
282 { -4.3527631662111383e+146, 100, 2.5000000000000000, 0.0 },
283 { -2.8809537014100589e+142, 100, 2.7500000000000000, 0.0 },
284 { -4.4102229953025611e+138, 100, 3.0000000000000000, 0.0 },
285 { -1.3651904154044740e+135, 100, 3.2500000000000000, 0.0 },
286 { -7.6980749101063267e+131, 100, 3.5000000000000000, 0.0 },
287 { -7.2790553499246662e+128, 100, 3.7500000000000000, 0.0 },
288 { -1.0796647795891517e+126, 100, 4.0000000000000000, 0.0 },
289 { -2.3785795774441247e+123, 100, 4.2500000000000000, 0.0 },
290 { -7.4391596631947432e+120, 100, 4.5000000000000000, 0.0 },
291 { -3.1802258278275794e+118, 100, 4.7500000000000000, 0.0 },
292 { -1.7997139826255660e+116, 100, 5.0000000000000000, 0.0 },
2be75957 293};
b4688136 294const double toler008 = 2.5000000000000014e-11;
2be75957
ESR
295// sph_neumann
296
297// Test data for n=0.
b4688136 298// max(|f - f_GSL|): 1.0165479569224090e-15 at index 12
2be75957 299// max(|f - f_GSL| / |f_GSL|): 5.9073915926662418e-13
b4688136
ESR
300// mean(f - f_GSL): 5.6194198599923690e-17
301// variance(f - f_GSL): 3.3904740513577990e-33
302// stddev(f - f_GSL): 5.8227777317684031e-17
2be75957
ESR
303const testcase_sph_neumann<double>
304data009[20] =
305{
b4688136
ESR
306 { -0.056732437092645263, 0, 5.0000000000000000, 0.0 },
307 { 0.083907152907645249, 0, 10.000000000000000, 0.0 },
308 { 0.050645860857254747, 0, 15.000000000000000, 0.0 },
309 { -0.020404103090669597, 0, 20.000000000000000, 0.0 },
310 { -0.039648112474538942, 0, 25.000000000000000, 0.0 },
311 { -0.0051417149962528020, 0, 30.000000000000000, 0.0 },
312 { 0.025819777288328762, 0, 35.000000000000000, 0.0 },
313 { 0.016673451541306544, 0, 40.000000000000000, 0.0 },
314 { -0.011673821973727327, 0, 45.000000000000000, 0.0 },
315 { -0.019299320569842265, 0, 50.000000000000000, 0.0 },
316 { -0.00040230465930828606, 0, 55.000000000000000, 0.0 },
317 { 0.015873549673585938, 0, 60.000000000000000, 0.0 },
318 { 0.0086531361728949541, 0, 65.000000000000000, 0.0 },
319 { -0.0090474171869471404, 0, 70.000000000000000, 0.0 },
320 { -0.012290016929663325, 0, 75.000000000000000, 0.0 },
321 { 0.0013798405479880944, 0, 80.000000000000000, 0.0 },
322 { 0.011580901686988727, 0, 85.000000000000000, 0.0 },
323 { 0.0049785957347685574, 0, 90.000000000000000, 0.0 },
324 { -0.0076860374841559963, 0, 95.000000000000000, 0.0 },
325 { -0.0086231887228768404, 0, 100.00000000000000, 0.0 },
2be75957
ESR
326};
327const double toler009 = 5.0000000000000028e-11;
328
329// Test data for n=1.
b4688136 330// max(|f - f_GSL|): 1.0486403412279799e-15 at index 14
2be75957 331// max(|f - f_GSL| / |f_GSL|): 3.5182047773188613e-13
b4688136
ESR
332// mean(f - f_GSL): 3.4759521649885275e-17
333// variance(f - f_GSL): 1.2285787353099413e-32
334// stddev(f - f_GSL): 1.1084127098287629e-16
2be75957
ESR
335const testcase_sph_neumann<double>
336data010[20] =
337{
b4688136
ESR
338 { 0.18043836751409864, 1, 5.0000000000000000, 0.0 },
339 { 0.062792826379701502, 1, 10.000000000000000, 0.0 },
340 { -0.039976131953324147, 1, 15.000000000000000, 0.0 },
341 { -0.046667467690914864, 1, 20.000000000000000, 0.0 },
342 { 0.0037081455049293634, 1, 25.000000000000000, 0.0 },
343 { 0.032762996969886965, 1, 30.000000000000000, 0.0 },
344 { 0.012971498479556563, 1, 35.000000000000000, 0.0 },
345 { -0.018210992723451058, 1, 40.000000000000000, 0.0 },
346 { -0.019168385477952129, 1, 45.000000000000000, 0.0 },
347 { 0.0048615106626817301, 1, 50.000000000000000, 0.0 },
348 { 0.018170052158169303, 1, 55.000000000000000, 0.0 },
349 { 0.0053447361795967109, 1, 60.000000000000000, 0.0 },
350 { -0.012587316051033977, 1, 65.000000000000000, 0.0 },
351 { -0.011184829982069090, 1, 70.000000000000000, 0.0 },
352 { 0.0050065549130635621, 1, 75.000000000000000, 0.0 },
353 { 0.012440856180892041, 1, 80.000000000000000, 0.0 },
354 { 0.0022077237839479508, 1, 85.000000000000000, 0.0 },
355 { -0.0098779785318421041, 1, 90.000000000000000, 0.0 },
356 { -0.0072731342338976518, 1, 95.000000000000000, 0.0 },
357 { 0.0049774245238688201, 1, 100.00000000000000, 0.0 },
2be75957
ESR
358};
359const double toler010 = 2.5000000000000014e-11;
360
361// Test data for n=2.
b4688136
ESR
362// max(|f - f_GSL|): 9.6971042307103517e-16 at index 12
363// max(|f - f_GSL| / |f_GSL|): 8.9366019038491149e-13
364// mean(f - f_GSL): -5.2854855908668341e-17
365// variance(f - f_GSL): 2.8843051158545336e-33
366// stddev(f - f_GSL): 5.3705727030313382e-17
2be75957
ESR
367const testcase_sph_neumann<double>
368data011[20] =
369{
b4688136
ESR
370 { 0.16499545760110443, 2, 5.0000000000000000, 0.0 },
371 { -0.065069304993734783, 2, 10.000000000000000, 0.0 },
372 { -0.058641087247919575, 2, 15.000000000000000, 0.0 },
373 { 0.013403982937032370, 2, 20.000000000000000, 0.0 },
374 { 0.040093089935130458, 2, 25.000000000000000, 0.0 },
375 { 0.0084180146932414986, 2, 30.000000000000000, 0.0 },
376 { -0.024707934561509628, 2, 35.000000000000000, 0.0 },
377 { -0.018039275995565374, 2, 40.000000000000000, 0.0 },
378 { 0.010395929608530518, 2, 45.000000000000000, 0.0 },
379 { 0.019591011209603170, 2, 50.000000000000000, 0.0 },
380 { 0.0013933984133902479, 2, 55.000000000000000, 0.0 },
381 { -0.015606312864606101, 2, 60.000000000000000, 0.0 },
382 { -0.0092340892214042153, 2, 65.000000000000000, 0.0 },
383 { 0.0085680673305727519, 2, 70.000000000000000, 0.0 },
384 { 0.012490279126185866, 2, 75.000000000000000, 0.0 },
385 { -0.00091330844120464274, 2, 80.000000000000000, 0.0 },
386 { -0.011502982024025860, 2, 85.000000000000000, 0.0 },
387 { -0.0053078616858299611, 2, 90.000000000000000, 0.0 },
388 { 0.0074563595609802797, 2, 95.000000000000000, 0.0 },
389 { 0.0087725114585929052, 2, 100.00000000000000, 0.0 },
2be75957
ESR
390};
391const double toler011 = 5.0000000000000028e-11;
392
393// Test data for n=5.
b4688136
ESR
394// max(|f - f_GSL|): 1.1301723445988898e-15 at index 14
395// max(|f - f_GSL| / |f_GSL|): 6.1915466104958656e-13
396// mean(f - f_GSL): 2.4660178413182797e-17
397// variance(f - f_GSL): 1.4883294310366547e-32
398// stddev(f - f_GSL): 1.2199710779508892e-16
2be75957
ESR
399const testcase_sph_neumann<double>
400data012[20] =
401{
b4688136
ESR
402 { -0.32046504674973919, 5, 5.0000000000000000, 0.0 },
403 { 0.093833541678691818, 5, 10.000000000000000, 0.0 },
404 { 0.020475698281859061, 5, 15.000000000000000, 0.0 },
405 { -0.048172347757372780, 5, 20.000000000000000, 0.0 },
406 { -0.018309489232548347, 5, 25.000000000000000, 0.0 },
407 { 0.026639390496569996, 5, 30.000000000000000, 0.0 },
408 { 0.022006038985576210, 5, 35.000000000000000, 0.0 },
409 { -0.011268975348057965, 5, 40.000000000000000, 0.0 },
410 { -0.021770388372274858, 5, 45.000000000000000, 0.0 },
411 { -0.00069711319645853701, 5, 50.000000000000000, 0.0 },
412 { 0.017439589450220901, 5, 55.000000000000000, 0.0 },
413 { 0.0088699170919343089, 5, 60.000000000000000, 0.0 },
414 { -0.010421334444951861, 5, 65.000000000000000, 0.0 },
415 { -0.012746769858008553, 5, 70.000000000000000, 0.0 },
416 { 0.0026282888028967737, 5, 75.000000000000000, 0.0 },
417 { 0.012477658581324189, 5, 80.000000000000000, 0.0 },
418 { 0.0040771816818182642, 5, 85.000000000000000, 0.0 },
419 { -0.0089777759570579818, 5, 90.000000000000000, 0.0 },
420 { -0.0083184557896676149, 5, 95.000000000000000, 0.0 },
421 { 0.0037206784862748965, 5, 100.00000000000000, 0.0 },
2be75957
ESR
422};
423const double toler012 = 5.0000000000000028e-11;
424
425// Test data for n=10.
b4688136 426// max(|f - f_GSL|): 1.0658141036401503e-14 at index 0
2be75957 427// max(|f - f_GSL| / |f_GSL|): 7.3655649039219020e-13
b4688136
ESR
428// mean(f - f_GSL): -6.1456915945168329e-16
429// variance(f - f_GSL): 2.1880640749018393e-32
430// stddev(f - f_GSL): 1.4792106256046972e-16
2be75957
ESR
431const testcase_sph_neumann<double>
432data013[20] =
433{
b4688136
ESR
434 { -26.656114405718711, 10, 5.0000000000000000, 0.0 },
435 { -0.17245367208805784, 10, 10.000000000000000, 0.0 },
436 { 0.078461689849642580, 10, 15.000000000000000, 0.0 },
437 { -0.036843410496289961, 10, 20.000000000000000, 0.0 },
438 { -0.021158339301097475, 10, 25.000000000000000, 0.0 },
439 { 0.031219591064754939, 10, 30.000000000000000, 0.0 },
440 { 0.012840593422414807, 10, 35.000000000000000, 0.0 },
441 { -0.021803068636888072, 10, 40.000000000000000, 0.0 },
442 { -0.014071636804469044, 10, 45.000000000000000, 0.0 },
443 { 0.013524687511158758, 10, 50.000000000000000, 0.0 },
444 { 0.015684932653180595, 10, 55.000000000000000, 0.0 },
445 { -0.0056356895567262122, 10, 60.000000000000000, 0.0 },
446 { -0.015364490270315362, 10, 65.000000000000000, 0.0 },
447 { -0.0014525575672261295, 10, 70.000000000000000, 0.0 },
448 { 0.012648951699549433, 10, 75.000000000000000, 0.0 },
449 { 0.0068571608061120367, 10, 80.000000000000000, 0.0 },
450 { -0.0080151152941401460, 10, 85.000000000000000, 0.0 },
451 { -0.0098139742219019149, 10, 90.000000000000000, 0.0 },
452 { 0.0025002854072314951, 10, 95.000000000000000, 0.0 },
453 { 0.010025777373636155, 10, 100.00000000000000, 0.0 },
2be75957
ESR
454};
455const double toler013 = 5.0000000000000028e-11;
456
457// Test data for n=20.
b4688136
ESR
458// max(|f - f_GSL|): 8.3446502685546875e-07 at index 0
459// max(|f - f_GSL| / |f_GSL|): 1.0502991318257211e-11
460// mean(f - f_GSL): -4.1723296986858874e-08
461// variance(f - f_GSL): 9.6445067152075506e-17
462// stddev(f - f_GSL): 9.8206449458309775e-09
2be75957
ESR
463const testcase_sph_neumann<double>
464data014[20] =
465{
b4688136
ESR
466 { -926795140.30575466, 20, 5.0000000000000000, 0.0 },
467 { -1211.2106053526036, 20, 10.000000000000000, 0.0 },
468 { -1.5559965765652175, 20, 15.000000000000000, 0.0 },
469 { -0.093401132250914398, 20, 20.000000000000000, 0.0 },
470 { 0.044031985675276462, 20, 25.000000000000000, 0.0 },
471 { -0.036078033606613907, 20, 30.000000000000000, 0.0 },
472 { 0.029828405631319645, 20, 35.000000000000000, 0.0 },
473 { -0.0048414810986760759, 20, 40.000000000000000, 0.0 },
474 { -0.020504694681516944, 20, 45.000000000000000, 0.0 },
475 { 0.013759531302541216, 20, 50.000000000000000, 0.0 },
476 { 0.012783038861734196, 20, 55.000000000000000, 0.0 },
477 { -0.013117009421906418, 20, 60.000000000000000, 0.0 },
478 { -0.010338106075674407, 20, 65.000000000000000, 0.0 },
479 { 0.010538610814111244, 20, 70.000000000000000, 0.0 },
480 { 0.010200029094273744, 20, 75.000000000000000, 0.0 },
481 { -0.0073123450945617122, 20, 80.000000000000000, 0.0 },
482 { -0.010581510354950906, 20, 85.000000000000000, 0.0 },
483 { 0.0036866374015298723, 20, 90.000000000000000, 0.0 },
484 { 0.010498384318338270, 20, 95.000000000000000, 0.0 },
485 { 5.6317293788334978e-05, 20, 100.00000000000000, 0.0 },
2be75957
ESR
486};
487const double toler014 = 1.0000000000000007e-09;
488
489// Test data for n=50.
b4688136
ESR
490// max(|f - f_GSL|): 2.1663950687494155e+29 at index 0
491// max(|f - f_GSL| / |f_GSL|): 4.4985159073786982e-13
492// mean(f - f_GSL): -1.0831975343747075e+28
493// variance(f - f_GSL): inf
494// stddev(f - f_GSL): inf
2be75957
ESR
495const testcase_sph_neumann<double>
496data015[20] =
497{
b4688136
ESR
498 { -6.9641091882701322e+42, 50, 5.0000000000000000, 0.0 },
499 { -4.5282272723513309e+27, 50, 10.000000000000000, 0.0 },
500 { -9.0004902645887672e+18, 50, 15.000000000000000, 0.0 },
501 { -9542541667002.5762, 50, 20.000000000000000, 0.0 },
502 { -363518140.71027178, 50, 25.000000000000000, 0.0 },
503 { -152551.57233157742, 50, 30.000000000000000, 0.0 },
504 { -386.26599186208688, 50, 35.000000000000000, 0.0 },
505 { -4.3290507947291097, 50, 40.000000000000000, 0.0 },
506 { -0.19968460851503717, 50, 45.000000000000000, 0.0 },
507 { -0.041900001504607758, 50, 50.000000000000000, 0.0 },
508 { 0.010696040672421926, 50, 55.000000000000000, 0.0 },
509 { 0.0078198768555268281, 50, 60.000000000000000, 0.0 },
510 { -0.010088474938191183, 50, 65.000000000000000, 0.0 },
511 { 0.0062423671279823656, 50, 70.000000000000000, 0.0 },
512 { 0.0011284242794942282, 50, 75.000000000000000, 0.0 },
513 { -0.0093934266037486308, 50, 80.000000000000000, 0.0 },
514 { 0.013108079602843421, 50, 85.000000000000000, 0.0 },
515 { -0.0075396607225721932, 50, 90.000000000000000, 0.0 },
516 { -0.0042605703552837304, 50, 95.000000000000000, 0.0 },
517 { 0.010747822973682467, 50, 100.00000000000000, 0.0 },
2be75957
ESR
518};
519const double toler015 = 2.5000000000000014e-11;
520
521// Test data for n=100.
b4688136
ESR
522// max(|f - f_GSL|): 3.7725700501057390e+103 at index 0
523// max(|f - f_GSL| / |f_GSL|): 2.0962053340286959e-13
524// mean(f - f_GSL): -1.8862850250528694e+102
525// variance(f - f_GSL): inf
526// stddev(f - f_GSL): inf
2be75957
ESR
527const testcase_sph_neumann<double>
528data016[20] =
529{
b4688136
ESR
530 { -1.7997139826255660e+116, 100, 5.0000000000000000, 0.0 },
531 { -8.5732263093288939e+85, 100, 10.000000000000000, 0.0 },
532 { -1.9270658593710037e+68, 100, 15.000000000000000, 0.0 },
533 { -7.2208893582950327e+55, 100, 20.000000000000000, 0.0 },
534 { -2.0868752613007361e+46, 100, 25.000000000000000, 0.0 },
535 { -4.2496124023610848e+38, 100, 30.000000000000000, 0.0 },
536 { -1.7042898348910030e+32, 100, 35.000000000000000, 0.0 },
537 { -6.3021565260722767e+26, 100, 40.000000000000000, 0.0 },
538 { -1.3199917400493998e+22, 100, 45.000000000000000, 0.0 },
539 { -1.1256928913265911e+18, 100, 50.000000000000000, 0.0 },
540 { -309801083340345.56, 100, 55.000000000000000, 0.0 },
541 { -232585620046.64404, 100, 60.000000000000000, 0.0 },
542 { -421135935.93755186, 100, 65.000000000000000, 0.0 },
543 { -1680637.4531202628, 100, 70.000000000000000, 0.0 },
544 { -13868.302591128748, 100, 75.000000000000000, 0.0 },
545 { -227.24385709173205, 100, 80.000000000000000, 0.0 },
546 { -7.2807038787138563, 100, 85.000000000000000, 0.0 },
547 { -0.46648154448250850, 100, 90.000000000000000, 0.0 },
548 { -0.067270772720654515, 100, 95.000000000000000, 0.0 },
549 { -0.022983850491562270, 100, 100.00000000000000, 0.0 },
2be75957 550};
b4688136 551const double toler016 = 2.5000000000000014e-11;
2be75957 552
b4688136 553template<typename Ret, unsigned int Num>
2be75957 554 void
b4688136 555 test(const testcase_sph_neumann<Ret> (&data)[Num], Ret toler)
2be75957 556 {
b4688136
ESR
557 bool test __attribute__((unused)) = true;
558 const Ret eps = std::numeric_limits<Ret>::epsilon();
559 Ret max_abs_diff = -Ret(1);
560 Ret max_abs_frac = -Ret(1);
2be75957
ESR
561 unsigned int num_datum = Num;
562 for (unsigned int i = 0; i < num_datum; ++i)
563 {
b4688136
ESR
564 const Ret f = std::sph_neumann(data[i].n, data[i].x);
565 const Ret f0 = data[i].f0;
566 const Ret diff = f - f0;
2be75957
ESR
567 if (std::abs(diff) > max_abs_diff)
568 max_abs_diff = std::abs(diff);
b4688136
ESR
569 if (std::abs(f0) > Ret(10) * eps
570 && std::abs(f) > Ret(10) * eps)
2be75957 571 {
b4688136 572 const Ret frac = diff / f0;
2be75957
ESR
573 if (std::abs(frac) > max_abs_frac)
574 max_abs_frac = std::abs(frac);
575 }
576 }
577 VERIFY(max_abs_frac < toler);
578 }
579
580int
581main()
582{
583 test(data001, toler001);
584 test(data002, toler002);
585 test(data003, toler003);
586 test(data004, toler004);
587 test(data005, toler005);
588 test(data006, toler006);
589 test(data007, toler007);
590 test(data008, toler008);
591 test(data009, toler009);
592 test(data010, toler010);
593 test(data011, toler011);
594 test(data012, toler012);
595 test(data013, toler013);
596 test(data014, toler014);
597 test(data015, toler015);
598 test(data016, toler016);
599 return 0;
600}