1 // { dg-do run { target c++11 } }
2 // { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
3 //
4 // Copyright (C) 2016-2018 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 //  cyl_bessel_j
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 // Test data for nu=0.0000000000000000.
41 // max(|f - f_GSL|): 1.0547118733938987e-14 at index 1
42 // max(|f - f_GSL| / |f_GSL|): 1.0733293243042314e-14
43 // mean(f - f_GSL): -2.4682636886755713e-15
44 // variance(f - f_GSL): 3.4179114172015086e-31
45 // stddev(f - f_GSL): 5.8462906335568952e-16
46 const testcase_cyl_bessel_j<double>
47 data007[21] =
48 {
49   { 1.0000000000000000, 0.0000000000000000, 0.0000000000000000, 0.0 },
50   { 0.98443592929585266, 0.0000000000000000, 0.25000000000000000, 0.0 },
51   { 0.93846980724081297, 0.0000000000000000, 0.50000000000000000, 0.0 },
52   { 0.86424227516664853, 0.0000000000000000, 0.75000000000000000, 0.0 },
53   { 0.76519768655796661, 0.0000000000000000, 1.0000000000000000, 0.0 },
54   { 0.64590608527128535, 0.0000000000000000, 1.2500000000000000, 0.0 },
55   { 0.51182767173591814, 0.0000000000000000, 1.5000000000000000, 0.0 },
56   { 0.36903253018515075, 0.0000000000000000, 1.7500000000000000, 0.0 },
57   { 0.22389077914123562, 0.0000000000000000, 2.0000000000000000, 0.0 },
58   { 0.082749851288734022, 0.0000000000000000, 2.2500000000000000, 0.0 },
59   { -0.048383776468197998, 0.0000000000000000, 2.5000000000000000, 0.0 },
60   { -0.16414142780851368, 0.0000000000000000, 2.7500000000000000, 0.0 },
61   { -0.26005195490193334, 0.0000000000000000, 3.0000000000000000, 0.0 },
62   { -0.33275080217061132, 0.0000000000000000, 3.2500000000000000, 0.0 },
63   { -0.38012773998726335, 0.0000000000000000, 3.5000000000000000, 0.0 },
64   { -0.40140605493617426, 0.0000000000000000, 3.7500000000000000, 0.0 },
65   { -0.39714980986384740, 0.0000000000000000, 4.0000000000000000, 0.0 },
66   { -0.36919977029989554, 0.0000000000000000, 4.2500000000000000, 0.0 },
67   { -0.32054250898512149, 0.0000000000000000, 4.5000000000000000, 0.0 },
68   { -0.25512082749137405, 0.0000000000000000, 4.7500000000000000, 0.0 },
69   { -0.17759677131433835, 0.0000000000000000, 5.0000000000000000, 0.0 },
70 };
71 const double toler007 = 1.0000000000000008e-12;
72 
73 // Test data for nu=0.33333333333333331.
74 // max(|f - f_GSL|): 4.4408920985006262e-16 at index 4
75 // max(|f - f_GSL| / |f_GSL|): 8.0807620553987087e-16
76 // mean(f - f_GSL): 1.2423924323186276e-16
77 // variance(f - f_GSL): 4.4388099670639150e-33
78 // stddev(f - f_GSL): 6.6624394684409066e-17
79 const testcase_cyl_bessel_j<double>
80 data008[21] =
81 {
82   { 0.0000000000000000, 0.33333333333333331, 0.0000000000000000, 0.0 },
83   { 0.55338359549647709, 0.33333333333333331, 0.25000000000000000, 0.0 },
84   { 0.67283082949794537, 0.33333333333333331, 0.50000000000000000, 0.0 },
85   { 0.72490863199379019, 0.33333333333333331, 0.75000000000000000, 0.0 },
86   { 0.73087640216944749, 0.33333333333333331, 1.0000000000000000, 0.0 },
87   { 0.69953374433894455, 0.33333333333333331, 1.2500000000000000, 0.0 },
88   { 0.63713263706489176, 0.33333333333333331, 1.5000000000000000, 0.0 },
89   { 0.54956352730788460, 0.33333333333333331, 1.7500000000000000, 0.0 },
90   { 0.44293981814857586, 0.33333333333333331, 2.0000000000000000, 0.0 },
91   { 0.32366988946292502, 0.33333333333333331, 2.2500000000000000, 0.0 },
92   { 0.19832093341860796, 0.33333333333333331, 2.5000000000000000, 0.0 },
93   { 0.073389637874297461, 0.33333333333333331, 2.7500000000000000, 0.0 },
94   { -0.044963820940233351, 0.33333333333333331, 3.0000000000000000, 0.0 },
95   { -0.15118395956666372, 0.33333333333333331, 3.2500000000000000, 0.0 },
96   { -0.24056593952693622, 0.33333333333333331, 3.5000000000000000, 0.0 },
97   { -0.30946094681921288, 0.33333333333333331, 3.7500000000000000, 0.0 },
98   { -0.35542737345457609, 0.33333333333333331, 4.0000000000000000, 0.0 },
99   { -0.37731852825457068, 0.33333333333333331, 4.2500000000000000, 0.0 },
100   { -0.37530189159358079, 0.33333333333333331, 4.5000000000000000, 0.0 },
101   { -0.35080916720916927, 0.33333333333333331, 4.7500000000000000, 0.0 },
102   { -0.30642046380026405, 0.33333333333333331, 5.0000000000000000, 0.0 },
103 };
104 const double toler008 = 2.5000000000000020e-13;
105 
106 // Test data for nu=0.50000000000000000.
107 // max(|f - f_GSL|): 5.5511151231257827e-16 at index 6
108 // max(|f - f_GSL| / |f_GSL|): 8.6943152885834554e-16
109 // mean(f - f_GSL): 1.6058583034756728e-16
110 // variance(f - f_GSL): 1.3538599676919272e-33
111 // stddev(f - f_GSL): 3.6794836155253190e-17
112 const testcase_cyl_bessel_j<double>
113 data009[21] =
114 {
115   { 0.0000000000000000, 0.50000000000000000, 0.0000000000000000, 0.0 },
116   { 0.39479959874136972, 0.50000000000000000, 0.25000000000000000, 0.0 },
117   { 0.54097378993452760, 0.50000000000000000, 0.50000000000000000, 0.0 },
118   { 0.62800587637588623, 0.50000000000000000, 0.75000000000000000, 0.0 },
119   { 0.67139670714180244, 0.50000000000000000, 1.0000000000000000, 0.0 },
120   { 0.67724253810014312, 0.50000000000000000, 1.2500000000000000, 0.0 },
121   { 0.64983807475374655, 0.50000000000000000, 1.5000000000000000, 0.0 },
122   { 0.59348525447147382, 0.50000000000000000, 1.7500000000000000, 0.0 },
123   { 0.51301613656182721, 0.50000000000000000, 2.0000000000000000, 0.0 },
124   { 0.41387506064759988, 0.50000000000000000, 2.2500000000000000, 0.0 },
125   { 0.30200490606236535, 0.50000000000000000, 2.5000000000000000, 0.0 },
126   { 0.18363332138431521, 0.50000000000000000, 2.7500000000000000, 0.0 },
127   { 0.065008182877375753, 0.50000000000000000, 3.0000000000000000, 0.0 },
128   { -0.047885729975898537, 0.50000000000000000, 3.2500000000000000, 0.0 },
129   { -0.14960456964952618, 0.50000000000000000, 3.5000000000000000, 0.0 },
130   { -0.23549801845815518, 0.50000000000000000, 3.7500000000000000, 0.0 },
131   { -0.30192051329163944, 0.50000000000000000, 4.0000000000000000, 0.0 },
132   { -0.34638850218952444, 0.50000000000000000, 4.2500000000000000, 0.0 },
133   { -0.36767487332724025, 0.50000000000000000, 4.5000000000000000, 0.0 },
134   { -0.36583563802350400, 0.50000000000000000, 4.7500000000000000, 0.0 },
135   { -0.34216798479816180, 0.50000000000000000, 5.0000000000000000, 0.0 },
136 };
137 const double toler009 = 2.5000000000000020e-13;
138 
139 // Test data for nu=0.66666666666666663.
140 // max(|f - f_GSL|): 1.2212453270876722e-15 at index 4
141 // max(|f - f_GSL| / |f_GSL|): 2.1504146437492276e-15
142 // mean(f - f_GSL): -4.8208791456193557e-16
143 // variance(f - f_GSL): 1.8468435800786558e-32
144 // stddev(f - f_GSL): 1.3589862324831168e-16
145 const testcase_cyl_bessel_j<double>
146 data010[21] =
147 {
148   { 0.0000000000000000, 0.66666666666666663, 0.0000000000000000, 0.0 },
149   { 0.27434438998865140, 0.66666666666666663, 0.25000000000000000, 0.0 },
150   { 0.42331075068448332, 0.66666666666666663, 0.50000000000000000, 0.0 },
151   { 0.52870551548162803, 0.66666666666666663, 0.75000000000000000, 0.0 },
152   { 0.59794997367362812, 0.66666666666666663, 1.0000000000000000, 0.0 },
153   { 0.63338726889075903, 0.66666666666666663, 1.2500000000000000, 0.0 },
154   { 0.63673234502877407, 0.66666666666666663, 1.5000000000000000, 0.0 },
155   { 0.61022230460131910, 0.66666666666666663, 1.7500000000000000, 0.0 },
156   { 0.55696967691913724, 0.66666666666666663, 2.0000000000000000, 0.0 },
157   { 0.48101276749106131, 0.66666666666666663, 2.2500000000000000, 0.0 },
158   { 0.38721242477084322, 0.66666666666666663, 2.5000000000000000, 0.0 },
159   { 0.28105724771080548, 0.66666666666666663, 2.7500000000000000, 0.0 },
160   { 0.16841218049067047, 0.66666666666666663, 3.0000000000000000, 0.0 },
161   { 0.055235893475364936, 0.66666666666666663, 3.2500000000000000, 0.0 },
162   { -0.052711584404031932, 0.66666666666666663, 3.5000000000000000, 0.0 },
163   { -0.15015178042293031, 0.66666666666666663, 3.7500000000000000, 0.0 },
164   { -0.23254408502670393, 0.66666666666666663, 4.0000000000000000, 0.0 },
165   { -0.29630067002972543, 0.66666666666666663, 4.2500000000000000, 0.0 },
166   { -0.33894810189777724, 0.66666666666666663, 4.5000000000000000, 0.0 },
167   { -0.35922706960321099, 0.66666666666666663, 4.7500000000000000, 0.0 },
168   { -0.35712533549168868, 0.66666666666666663, 5.0000000000000000, 0.0 },
169 };
170 const double toler010 = 2.5000000000000020e-13;
171 
172 // Test data for nu=1.0000000000000000.
173 // max(|f - f_GSL|): 6.1062266354383610e-15 at index 7
174 // max(|f - f_GSL| / |f_GSL|): 1.0805601471765146e-14
175 // mean(f - f_GSL): -2.7170725986585303e-15
176 // variance(f - f_GSL): 4.1990134041171014e-31
177 // stddev(f - f_GSL): 6.4799794784529226e-16
178 const testcase_cyl_bessel_j<double>
179 data011[21] =
180 {
181   { 0.0000000000000000, 1.0000000000000000, 0.0000000000000000, 0.0 },
182   { 0.12402597732272694, 1.0000000000000000, 0.25000000000000000, 0.0 },
183   { 0.24226845767487390, 1.0000000000000000, 0.50000000000000000, 0.0 },
184   { 0.34924360217486222, 1.0000000000000000, 0.75000000000000000, 0.0 },
185   { 0.44005058574493355, 1.0000000000000000, 1.0000000000000000, 0.0 },
186   { 0.51062326031988059, 1.0000000000000000, 1.2500000000000000, 0.0 },
187   { 0.55793650791009952, 1.0000000000000000, 1.5000000000000000, 0.0 },
188   { 0.58015619763899240, 1.0000000000000000, 1.7500000000000000, 0.0 },
189   { 0.57672480775687363, 1.0000000000000000, 2.0000000000000000, 0.0 },
190   { 0.54837835664696011, 1.0000000000000000, 2.2500000000000000, 0.0 },
191   { 0.49709410246427416, 1.0000000000000000, 2.5000000000000000, 0.0 },
192   { 0.42597230295790256, 1.0000000000000000, 2.7500000000000000, 0.0 },
193   { 0.33905895852593648, 1.0000000000000000, 3.0000000000000000, 0.0 },
194   { 0.24111968801520400, 1.0000000000000000, 3.2500000000000000, 0.0 },
195   { 0.13737752736232706, 1.0000000000000000, 3.5000000000000000, 0.0 },
196   { 0.033229349129679724, 1.0000000000000000, 3.7500000000000000, 0.0 },
197   { -0.066043328023549230, 1.0000000000000000, 4.0000000000000000, 0.0 },
198   { -0.15555319297834286, 1.0000000000000000, 4.2500000000000000, 0.0 },
199   { -0.23106043192337070, 1.0000000000000000, 4.5000000000000000, 0.0 },
200   { -0.28918679864711044, 1.0000000000000000, 4.7500000000000000, 0.0 },
201   { -0.32757913759146529, 1.0000000000000000, 5.0000000000000000, 0.0 },
202 };
203 const double toler011 = 1.0000000000000008e-12;
204 
205 // Test data for nu=2.0000000000000000.
206 // max(|f - f_GSL|): 5.1625370645069779e-15 at index 12
207 // max(|f - f_GSL| / |f_GSL|): 1.0822675144009871e-14
208 // mean(f - f_GSL): -2.7863789318177942e-15
209 // variance(f - f_GSL): 2.7454120215792639e-31
210 // stddev(f - f_GSL): 5.2396679490014096e-16
211 const testcase_cyl_bessel_j<double>
212 data012[21] =
213 {
214   { 0.0000000000000000, 2.0000000000000000, 0.0000000000000000, 0.0 },
215   { 0.0077718892859626760, 2.0000000000000000, 0.25000000000000000, 0.0 },
216   { 0.030604023458682638, 2.0000000000000000, 0.50000000000000000, 0.0 },
217   { 0.067073997299650551, 2.0000000000000000, 0.75000000000000000, 0.0 },
218   { 0.11490348493190047, 2.0000000000000000, 1.0000000000000000, 0.0 },
219   { 0.17109113124052350, 2.0000000000000000, 1.2500000000000000, 0.0 },
220   { 0.23208767214421472, 2.0000000000000000, 1.5000000000000000, 0.0 },
221   { 0.29400312425941216, 2.0000000000000000, 1.7500000000000000, 0.0 },
222   { 0.35283402861563773, 2.0000000000000000, 2.0000000000000000, 0.0 },
223   { 0.40469757684189717, 2.0000000000000000, 2.2500000000000000, 0.0 },
224   { 0.44605905843961718, 2.0000000000000000, 2.5000000000000000, 0.0 },
225   { 0.47393946632335160, 2.0000000000000000, 2.7500000000000000, 0.0 },
226   { 0.48609126058589119, 2.0000000000000000, 3.0000000000000000, 0.0 },
227   { 0.48113214864150627, 2.0000000000000000, 3.2500000000000000, 0.0 },
228   { 0.45862918419430765, 2.0000000000000000, 3.5000000000000000, 0.0 },
229   { 0.41912837447200352, 2.0000000000000000, 3.7500000000000000, 0.0 },
230   { 0.36412814585207293, 2.0000000000000000, 4.0000000000000000, 0.0 },
231   { 0.29599826772185189, 2.0000000000000000, 4.2500000000000000, 0.0 },
232   { 0.21784898368584549, 2.0000000000000000, 4.5000000000000000, 0.0 },
233   { 0.13335796490311685, 2.0000000000000000, 4.7500000000000000, 0.0 },
234   { 0.046565116277751971, 2.0000000000000000, 5.0000000000000000, 0.0 },
235 };
236 const double toler012 = 1.0000000000000008e-12;
237 
238 // Test data for nu=5.0000000000000000.
239 // max(|f - f_GSL|): 2.6645352591003757e-15 at index 20
240 // max(|f - f_GSL| / |f_GSL|): 1.1360392768632928e-14
241 // mean(f - f_GSL): -6.6594499701393519e-16
242 // variance(f - f_GSL): 2.0970405937460423e-31
243 // stddev(f - f_GSL): 4.5793455796063728e-16
244 const testcase_cyl_bessel_j<double>
245 data013[21] =
246 {
247   { 0.0000000000000000, 5.0000000000000000, 0.0000000000000000, 0.0 },
248   { 2.5365161587472413e-07, 5.0000000000000000, 0.25000000000000000, 0.0 },
249   { 8.0536272413574753e-06, 5.0000000000000000, 0.50000000000000000, 0.0 },
250   { 6.0364166510576438e-05, 5.0000000000000000, 0.75000000000000000, 0.0 },
251   { 0.00024975773021123450, 5.0000000000000000, 1.0000000000000000, 0.0 },
252   { 0.00074440885254749821, 5.0000000000000000, 1.2500000000000000, 0.0 },
253   { 0.0017994217673606111, 5.0000000000000000, 1.5000000000000000, 0.0 },
254   { 0.0037577257273157133, 5.0000000000000000, 1.7500000000000000, 0.0 },
255   { 0.0070396297558716842, 5.0000000000000000, 2.0000000000000000, 0.0 },
256   { 0.012121078633445751, 5.0000000000000000, 2.2500000000000000, 0.0 },
257   { 0.019501625134503223, 5.0000000000000000, 2.5000000000000000, 0.0 },
258   { 0.029664058320006174, 5.0000000000000000, 2.7500000000000000, 0.0 },
259   { 0.043028434877047578, 5.0000000000000000, 3.0000000000000000, 0.0 },
260   { 0.059903888098560426, 5.0000000000000000, 3.2500000000000000, 0.0 },
261   { 0.080441986647991792, 5.0000000000000000, 3.5000000000000000, 0.0 },
262   { 0.10459554742314070, 5.0000000000000000, 3.7500000000000000, 0.0 },
263   { 0.13208665604709827, 5.0000000000000000, 4.0000000000000000, 0.0 },
264   { 0.16238721643623680, 5.0000000000000000, 4.2500000000000000, 0.0 },
265   { 0.19471465863871368, 5.0000000000000000, 4.5000000000000000, 0.0 },
266   { 0.22804452118769436, 5.0000000000000000, 4.7500000000000000, 0.0 },
267   { 0.26114054612017007, 5.0000000000000000, 5.0000000000000000, 0.0 },
268 };
269 const double toler013 = 1.0000000000000008e-12;
270 
271 // Test data for nu=10.000000000000000.
272 // max(|f - f_GSL|): 1.6263032587282567e-17 at index 20
273 // max(|f - f_GSL| / |f_GSL|): 1.2824480053608853e-14
274 // mean(f - f_GSL): -1.9939226062419386e-18
275 // variance(f - f_GSL): 1.0689393731679246e-35
276 // stddev(f - f_GSL): 3.2694638293884283e-18
277 const testcase_cyl_bessel_j<double>
278 data014[21] =
279 {
280   { 0.0000000000000000, 10.000000000000000, 0.0000000000000000, 0.0 },
281   { 2.5628321598050096e-16, 10.000000000000000, 0.25000000000000000, 0.0 },
282   { 2.6131773608228023e-13, 10.000000000000000, 0.50000000000000000, 0.0 },
283   { 1.4962171311759677e-11, 10.000000000000000, 0.75000000000000000, 0.0 },
284   { 2.6306151236874524e-10, 10.000000000000000, 1.0000000000000000, 0.0 },
285   { 2.4187548221114514e-09, 10.000000000000000, 1.2500000000000000, 0.0 },
286   { 1.4743269078039996e-08, 10.000000000000000, 1.5000000000000000, 0.0 },
287   { 6.7608502849897560e-08, 10.000000000000000, 1.7500000000000000, 0.0 },
288   { 2.5153862827167358e-07, 10.000000000000000, 2.0000000000000000, 0.0 },
289   { 7.9717051583730038e-07, 10.000000000000000, 2.2500000000000000, 0.0 },
290   { 2.2247284173983839e-06, 10.000000000000000, 2.5000000000000000, 0.0 },
291   { 5.5985475639210430e-06, 10.000000000000000, 2.7500000000000000, 0.0 },
292   { 1.2928351645715880e-05, 10.000000000000000, 3.0000000000000000, 0.0 },
293   { 2.7761691354244538e-05, 10.000000000000000, 3.2500000000000000, 0.0 },
294   { 5.6009495875078844e-05, 10.000000000000000, 3.5000000000000000, 0.0 },
295   { 0.00010703761729231951, 10.000000000000000, 3.7500000000000000, 0.0 },
296   { 0.00019504055466003446, 10.000000000000000, 4.0000000000000000, 0.0 },
297   { 0.00034068888474064193, 10.000000000000000, 4.2500000000000000, 0.0 },
298   { 0.00057300977667164505, 10.000000000000000, 4.5000000000000000, 0.0 },
299   { 0.00093142172588886810, 10.000000000000000, 4.7500000000000000, 0.0 },
300   { 0.0014678026473104744, 10.000000000000000, 5.0000000000000000, 0.0 },
301 };
302 const double toler014 = 1.0000000000000008e-12;
303 
304 // Test data for nu=20.000000000000000.
305 // max(|f - f_GSL|): 3.8450973786644646e-25 at index 20
306 // max(|f - f_GSL| / |f_GSL|): 1.6112330065488876e-14
307 // mean(f - f_GSL): -2.9366599259721097e-26
308 // variance(f - f_GSL): 6.6216490672203760e-51
309 // stddev(f - f_GSL): 8.1373515760475631e-26
310 const testcase_cyl_bessel_j<double>
311 data015[21] =
312 {
313   { 0.0000000000000000, 20.000000000000000, 0.0000000000000000, 0.0 },
314   { 3.5624805510586969e-37, 20.000000000000000, 0.25000000000000000, 0.0 },
315   { 3.7272019617047132e-31, 20.000000000000000, 0.50000000000000000, 0.0 },
316   { 1.2347870693633488e-27, 20.000000000000000, 0.75000000000000000, 0.0 },
317   { 3.8735030085246562e-25, 20.000000000000000, 1.0000000000000000, 0.0 },
318   { 3.3372897667043766e-23, 20.000000000000000, 1.2500000000000000, 0.0 },
319   { 1.2689972189332558e-21, 20.000000000000000, 1.5000000000000000, 0.0 },
320   { 2.7427715944032989e-20, 20.000000000000000, 1.7500000000000000, 0.0 },
321   { 3.9189728050907524e-19, 20.000000000000000, 2.0000000000000000, 0.0 },
322   { 4.0805232551365158e-18, 20.000000000000000, 2.2500000000000000, 0.0 },
323   { 3.3090793836587786e-17, 20.000000000000000, 2.5000000000000000, 0.0 },
324   { 2.1915404680645990e-16, 20.000000000000000, 2.7500000000000000, 0.0 },
325   { 1.2275946737992981e-15, 20.000000000000000, 3.0000000000000000, 0.0 },
326   { 5.9727663938305382e-15, 20.000000000000000, 3.2500000000000000, 0.0 },
327   { 2.5768553102807590e-14, 20.000000000000000, 3.5000000000000000, 0.0 },
328   { 1.0021112208287217e-13, 20.000000000000000, 3.7500000000000000, 0.0 },
329   { 3.5595116285938516e-13, 20.000000000000000, 4.0000000000000000, 0.0 },
330   { 1.1673622958555074e-12, 20.000000000000000, 4.2500000000000000, 0.0 },
331   { 3.5665470983611762e-12, 20.000000000000000, 4.5000000000000000, 0.0 },
332   { 1.0227564044880958e-11, 20.000000000000000, 4.7500000000000000, 0.0 },
333   { 2.7703300521289426e-11, 20.000000000000000, 5.0000000000000000, 0.0 },
334 };
335 const double toler015 = 1.0000000000000008e-12;
336 //  cyl_bessel_j
337 
338 // Test data for nu=0.0000000000000000.
339 // max(|f - f_GSL|): 7.6709472107694410e-15 at index 13
340 // max(|f - f_GSL| / |f_GSL|): 4.1048891312746575e-13
341 // mean(f - f_GSL): -4.8105534106433027e-16
342 // variance(f - f_GSL): 9.0295585401833436e-31
343 // stddev(f - f_GSL): 9.5023989287881106e-16
344 const testcase_cyl_bessel_j<double>
345 data016[21] =
346 {
347   { 1.0000000000000000, 0.0000000000000000, 0.0000000000000000, 0.0 },
348   { -0.17759677131433835, 0.0000000000000000, 5.0000000000000000, 0.0 },
349   { -0.24593576445134835, 0.0000000000000000, 10.000000000000000, 0.0 },
350   { -0.014224472826780771, 0.0000000000000000, 15.000000000000000, 0.0 },
351   { 0.16702466434058319, 0.0000000000000000, 20.000000000000000, 0.0 },
352   { 0.096266783275958154, 0.0000000000000000, 25.000000000000000, 0.0 },
353   { -0.086367983581040142, 0.0000000000000000, 30.000000000000000, 0.0 },
354   { -0.12684568275631256, 0.0000000000000000, 35.000000000000000, 0.0 },
355   { 0.0073668905842374085, 0.0000000000000000, 40.000000000000000, 0.0 },
356   { 0.11581867067325631, 0.0000000000000000, 45.000000000000000, 0.0 },
357   { 0.055812327669251746, 0.0000000000000000, 50.000000000000000, 0.0 },
358   { -0.074548302648236808, 0.0000000000000000, 55.000000000000000, 0.0 },
359   { -0.091471804089061859, 0.0000000000000000, 60.000000000000000, 0.0 },
360   { 0.018687343227677979, 0.0000000000000000, 65.000000000000000, 0.0 },
361   { 0.094908726483013545, 0.0000000000000000, 70.000000000000000, 0.0 },
362   { 0.034643913805097008, 0.0000000000000000, 75.000000000000000, 0.0 },
363   { -0.069742165512210033, 0.0000000000000000, 80.000000000000000, 0.0 },
364   { -0.070940394796273273, 0.0000000000000000, 85.000000000000000, 0.0 },
365   { 0.026630016699969526, 0.0000000000000000, 90.000000000000000, 0.0 },
366   { 0.081811967783384135, 0.0000000000000000, 95.000000000000000, 0.0 },
367   { 0.019985850304223170, 0.0000000000000000, 100.00000000000000, 0.0 },
368 };
369 const double toler016 = 2.5000000000000014e-11;
370 
371 // Test data for nu=0.33333333333333331.
372 // max(|f - f_GSL|): 7.9363599025938925e-15 at index 15
373 // max(|f - f_GSL| / |f_GSL|): 4.2442260743498463e-12
374 // mean(f - f_GSL): -4.0073144868561849e-16
375 // variance(f - f_GSL): 1.2341887679989061e-30
376 // stddev(f - f_GSL): 1.1109404880545609e-15
377 const testcase_cyl_bessel_j<double>
378 data017[21] =
379 {
380   { 0.0000000000000000, 0.33333333333333331, 0.0000000000000000, 0.0 },
381   { -0.30642046380026405, 0.33333333333333331, 5.0000000000000000, 0.0 },
382   { -0.18614516704869571, 0.33333333333333331, 10.000000000000000, 0.0 },
383   { 0.089740004221152650, 0.33333333333333331, 15.000000000000000, 0.0 },
384   { 0.17606058001293901, 0.33333333333333331, 20.000000000000000, 0.0 },
385   { 0.020097162141383233, 0.33333333333333331, 25.000000000000000, 0.0 },
386   { -0.13334053387426159, 0.33333333333333331, 30.000000000000000, 0.0 },
387   { -0.087118009397765497, 0.33333333333333331, 35.000000000000000, 0.0 },
388   { 0.069202942818858179, 0.33333333333333331, 40.000000000000000, 0.0 },
389   { 0.11387616964518317, 0.33333333333333331, 45.000000000000000, 0.0 },
390   { -0.00057226680771808045, 0.33333333333333331, 50.000000000000000, 0.0 },
391   { -0.10331600929280822, 0.33333333333333331, 55.000000000000000, 0.0 },
392   { -0.055618147270528003, 0.33333333333333331, 60.000000000000000, 0.0 },
393   { 0.064711954014113948, 0.33333333333333331, 65.000000000000000, 0.0 },
394   { 0.086879926462481605, 0.33333333333333331, 70.000000000000000, 0.0 },
395   { -0.012614484229891068, 0.33333333333333331, 75.000000000000000, 0.0 },
396   { -0.088199784400034537, 0.33333333333333331, 80.000000000000000, 0.0 },
397   { -0.036703611076564523, 0.33333333333333331, 85.000000000000000, 0.0 },
398   { 0.062916286828779547, 0.33333333333333331, 90.000000000000000, 0.0 },
399   { 0.069465244416806030, 0.33333333333333331, 95.000000000000000, 0.0 },
400   { -0.021271244853702364, 0.33333333333333331, 100.00000000000000, 0.0 },
401 };
402 const double toler017 = 2.5000000000000017e-10;
403 
404 // Test data for nu=0.50000000000000000.
405 // max(|f - f_GSL|): 7.4384942649885488e-15 at index 15
406 // max(|f - f_GSL| / |f_GSL|): 3.6736636954373887e-13
407 // mean(f - f_GSL): -2.3914402204537413e-16
408 // variance(f - f_GSL): 7.8293530348883143e-31
409 // stddev(f - f_GSL): 8.8483631451745435e-16
410 const testcase_cyl_bessel_j<double>
411 data018[21] =
412 {
413   { 0.0000000000000000, 0.50000000000000000, 0.0000000000000000, 0.0 },
414   { -0.34216798479816180, 0.50000000000000000, 5.0000000000000000, 0.0 },
415   { -0.13726373575505049, 0.50000000000000000, 10.000000000000000, 0.0 },
416   { 0.13396768882243937, 0.50000000000000000, 15.000000000000000, 0.0 },
417   { 0.16288076385502984, 0.50000000000000000, 20.000000000000000, 0.0 },
418   { -0.021120283599650493, 0.50000000000000000, 25.000000000000000, 0.0 },
419   { -0.14392965337039987, 0.50000000000000000, 30.000000000000000, 0.0 },
420   { -0.057747757589458777, 0.50000000000000000, 35.000000000000000, 0.0 },
421   { 0.094000962389533649, 0.50000000000000000, 40.000000000000000, 0.0 },
422   { 0.10120783324271411, 0.50000000000000000, 45.000000000000000, 0.0 },
423   { -0.029605831888924641, 0.50000000000000000, 50.000000000000000, 0.0 },
424   { -0.10756039213265806, 0.50000000000000000, 55.000000000000000, 0.0 },
425   { -0.031397461182520438, 0.50000000000000000, 60.000000000000000, 0.0 },
426   { 0.081827430775628554, 0.50000000000000000, 65.000000000000000, 0.0 },
427   { 0.073802429539054554, 0.50000000000000000, 70.000000000000000, 0.0 },
428   { -0.035727009681702615, 0.50000000000000000, 75.000000000000000, 0.0 },
429   { -0.088661035811765460, 0.50000000000000000, 80.000000000000000, 0.0 },
430   { -0.015238065106312516, 0.50000000000000000, 85.000000000000000, 0.0 },
431   { 0.075189068550269425, 0.50000000000000000, 90.000000000000000, 0.0 },
432   { 0.055932643481494133, 0.50000000000000000, 95.000000000000000, 0.0 },
433   { -0.040402132716252127, 0.50000000000000000, 100.00000000000000, 0.0 },
434 };
435 const double toler018 = 2.5000000000000014e-11;
436 
437 // Test data for nu=0.66666666666666663.
438 // max(|f - f_GSL|): 6.3699046037868357e-15 at index 15
439 // max(|f - f_GSL| / |f_GSL|): 1.2249770426844829e-12
440 // mean(f - f_GSL): -1.1601995819092502e-16
441 // variance(f - f_GSL): 5.5905222078728605e-31
442 // stddev(f - f_GSL): 7.4769794756123678e-16
443 const testcase_cyl_bessel_j<double>
444 data019[21] =
445 {
446   { 0.0000000000000000, 0.66666666666666663, 0.0000000000000000, 0.0 },
447   { -0.35712533549168868, 0.66666666666666663, 5.0000000000000000, 0.0 },
448   { -0.080149603304315808, 0.66666666666666663, 10.000000000000000, 0.0 },
449   { 0.16918875175798079, 0.66666666666666663, 15.000000000000000, 0.0 },
450   { 0.13904826122116531, 0.66666666666666663, 20.000000000000000, 0.0 },
451   { -0.060770629698497600, 0.66666666666666663, 25.000000000000000, 0.0 },
452   { -0.14489851974205062, 0.66666666666666663, 30.000000000000000, 0.0 },
453   { -0.024604880159644394, 0.66666666666666663, 35.000000000000000, 0.0 },
454   { 0.11243936464912010, 0.66666666666666663, 40.000000000000000, 0.0 },
455   { 0.081776275512525309, 0.66666666666666663, 45.000000000000000, 0.0 },
456   { -0.056589908749367777, 0.66666666666666663, 50.000000000000000, 0.0 },
457   { -0.10455814523765931, 0.66666666666666663, 55.000000000000000, 0.0 },
458   { -0.0051030148548608456, 0.66666666666666663, 60.000000000000000, 0.0 },
459   { 0.093398227061639236, 0.66666666666666663, 65.000000000000000, 0.0 },
460   { 0.055763883611864913, 0.66666666666666663, 70.000000000000000, 0.0 },
461   { -0.056395322915757364, 0.66666666666666663, 75.000000000000000, 0.0 },
462   { -0.083131347805783087, 0.66666666666666663, 80.000000000000000, 0.0 },
463   { 0.0072315397874096648, 0.66666666666666663, 85.000000000000000, 0.0 },
464   { 0.082362798520905250, 0.66666666666666663, 90.000000000000000, 0.0 },
465   { 0.038630504403446168, 0.66666666666666663, 95.000000000000000, 0.0 },
466   { -0.056778819380529734, 0.66666666666666663, 100.00000000000000, 0.0 },
467 };
468 const double toler019 = 1.0000000000000006e-10;
469 
470 // Test data for nu=1.0000000000000000.
471 // max(|f - f_GSL|): 7.1418565505965148e-15 at index 14
472 // max(|f - f_GSL| / |f_GSL|): 1.7859762266854228e-12
473 // mean(f - f_GSL): 9.6132592627048056e-17
474 // variance(f - f_GSL): 8.7314103995980843e-32
475 // stddev(f - f_GSL): 2.9548960048702366e-16
476 const testcase_cyl_bessel_j<double>
477 data020[21] =
478 {
479   { 0.0000000000000000, 1.0000000000000000, 0.0000000000000000, 0.0 },
480   { -0.32757913759146529, 1.0000000000000000, 5.0000000000000000, 0.0 },
481   { 0.043472746168861459, 1.0000000000000000, 10.000000000000000, 0.0 },
482   { 0.20510403861352280, 1.0000000000000000, 15.000000000000000, 0.0 },
483   { 0.066833124175850078, 1.0000000000000000, 20.000000000000000, 0.0 },
484   { -0.12535024958028990, 1.0000000000000000, 25.000000000000000, 0.0 },
485   { -0.11875106261662294, 1.0000000000000000, 30.000000000000000, 0.0 },
486   { 0.043990942179625646, 1.0000000000000000, 35.000000000000000, 0.0 },
487   { 0.12603831803758500, 1.0000000000000000, 40.000000000000000, 0.0 },
488   { 0.028348854376424561, 1.0000000000000000, 45.000000000000000, 0.0 },
489   { -0.097511828125175129, 1.0000000000000000, 50.000000000000000, 0.0 },
490   { -0.078250038308684711, 1.0000000000000000, 55.000000000000000, 0.0 },
491   { 0.046598383758166370, 1.0000000000000000, 60.000000000000000, 0.0 },
492   { 0.097330172226126929, 1.0000000000000000, 65.000000000000000, 0.0 },
493   { 0.0099877887848385128, 1.0000000000000000, 70.000000000000000, 0.0 },
494   { -0.085139995044829081, 1.0000000000000000, 75.000000000000000, 0.0 },
495   { -0.056057296675712555, 1.0000000000000000, 80.000000000000000, 0.0 },
496   { 0.049151460334891130, 1.0000000000000000, 85.000000000000000, 0.0 },
497   { 0.079925646708868092, 1.0000000000000000, 90.000000000000000, 0.0 },
498   { -0.0023925612997269283, 1.0000000000000000, 95.000000000000000, 0.0 },
499   { -0.077145352014112129, 1.0000000000000000, 100.00000000000000, 0.0 },
500 };
501 const double toler020 = 1.0000000000000006e-10;
502 
503 // Test data for nu=2.0000000000000000.
504 // max(|f - f_GSL|): 7.5980888247784151e-15 at index 13
505 // max(|f - f_GSL| / |f_GSL|): 2.0010877493528614e-12
506 // mean(f - f_GSL): 4.4867383617942993e-16
507 // variance(f - f_GSL): 8.9441502176883788e-31
508 // stddev(f - f_GSL): 9.4573517528367196e-16
509 const testcase_cyl_bessel_j<double>
510 data021[21] =
511 {
512   { 0.0000000000000000, 2.0000000000000000, 0.0000000000000000, 0.0 },
513   { 0.046565116277751971, 2.0000000000000000, 5.0000000000000000, 0.0 },
514   { 0.25463031368512068, 2.0000000000000000, 10.000000000000000, 0.0 },
515   { 0.041571677975250486, 2.0000000000000000, 15.000000000000000, 0.0 },
516   { -0.16034135192299820, 2.0000000000000000, 20.000000000000000, 0.0 },
517   { -0.10629480324238134, 2.0000000000000000, 25.000000000000000, 0.0 },
518   { 0.078451246073265299, 2.0000000000000000, 30.000000000000000, 0.0 },
519   { 0.12935945088086259, 2.0000000000000000, 35.000000000000000, 0.0 },
520   { -0.0010649746823579794, 2.0000000000000000, 40.000000000000000, 0.0 },
521   { -0.11455872158985966, 2.0000000000000000, 45.000000000000000, 0.0 },
522   { -0.059712800794258863, 2.0000000000000000, 50.000000000000000, 0.0 },
523   { 0.071702846709739240, 2.0000000000000000, 55.000000000000000, 0.0 },
524   { 0.093025083547667420, 2.0000000000000000, 60.000000000000000, 0.0 },
525   { -0.015692568697643128, 2.0000000000000000, 65.000000000000000, 0.0 },
526   { -0.094623361089161029, 2.0000000000000000, 70.000000000000000, 0.0 },
527   { -0.036914313672959179, 2.0000000000000000, 75.000000000000000, 0.0 },
528   { 0.068340733095317172, 2.0000000000000000, 80.000000000000000, 0.0 },
529   { 0.072096899745329540, 2.0000000000000000, 85.000000000000000, 0.0 },
530   { -0.024853891217550248, 2.0000000000000000, 90.000000000000000, 0.0 },
531   { -0.081862337494957332, 2.0000000000000000, 95.000000000000000, 0.0 },
532   { -0.021528757344505364, 2.0000000000000000, 100.00000000000000, 0.0 },
533 };
534 const double toler021 = 2.5000000000000017e-10;
535 
536 // Test data for nu=5.0000000000000000.
537 // max(|f - f_GSL|): 6.8452188362044808e-15 at index 14
538 // max(|f - f_GSL| / |f_GSL|): 5.6871180922055143e-13
539 // mean(f - f_GSL): -8.6612264979127729e-17
540 // variance(f - f_GSL): 1.4989992815624512e-31
541 // stddev(f - f_GSL): 3.8716912087128681e-16
542 const testcase_cyl_bessel_j<double>
543 data022[21] =
544 {
545   { 0.0000000000000000, 5.0000000000000000, 0.0000000000000000, 0.0 },
546   { 0.26114054612017007, 5.0000000000000000, 5.0000000000000000, 0.0 },
547   { -0.23406152818679371, 5.0000000000000000, 10.000000000000000, 0.0 },
548   { 0.13045613456502966, 5.0000000000000000, 15.000000000000000, 0.0 },
549   { 0.15116976798239498, 5.0000000000000000, 20.000000000000000, 0.0 },
550   { -0.066007995398422933, 5.0000000000000000, 25.000000000000000, 0.0 },
551   { -0.14324029551207709, 5.0000000000000000, 30.000000000000000, 0.0 },
552   { -0.0015053072953907251, 5.0000000000000000, 35.000000000000000, 0.0 },
553   { 0.12257346597711777, 5.0000000000000000, 40.000000000000000, 0.0 },
554   { 0.057984499200954109, 5.0000000000000000, 45.000000000000000, 0.0 },
555   { -0.081400247696569616, 5.0000000000000000, 50.000000000000000, 0.0 },
556   { -0.092569895786432765, 5.0000000000000000, 55.000000000000000, 0.0 },
557   { 0.027454744228344204, 5.0000000000000000, 60.000000000000000, 0.0 },
558   { 0.099110527701539025, 5.0000000000000000, 65.000000000000000, 0.0 },
559   { 0.026058129823895364, 5.0000000000000000, 70.000000000000000, 0.0 },
560   { -0.078523977013751398, 5.0000000000000000, 75.000000000000000, 0.0 },
561   { -0.065862349140031584, 5.0000000000000000, 80.000000000000000, 0.0 },
562   { 0.038669072284680979, 5.0000000000000000, 85.000000000000000, 0.0 },
563   { 0.082759319528415157, 5.0000000000000000, 90.000000000000000, 0.0 },
564   { 0.0079423372702472871, 5.0000000000000000, 95.000000000000000, 0.0 },
565   { -0.074195736964513898, 5.0000000000000000, 100.00000000000000, 0.0 },
566 };
567 const double toler022 = 5.0000000000000028e-11;
568 
569 // Test data for nu=10.000000000000000.
570 // max(|f - f_GSL|): 7.2337968948232856e-15 at index 18
571 // max(|f - f_GSL| / |f_GSL|): 3.6992532852132266e-13
572 // mean(f - f_GSL): 4.8246996675604947e-16
573 // variance(f - f_GSL): 7.6040256561433464e-31
574 // stddev(f - f_GSL): 8.7201064535608434e-16
575 const testcase_cyl_bessel_j<double>
576 data023[21] =
577 {
578   { 0.0000000000000000, 10.000000000000000, 0.0000000000000000, 0.0 },
579   { 0.0014678026473104744, 10.000000000000000, 5.0000000000000000, 0.0 },
580   { 0.20748610663335865, 10.000000000000000, 10.000000000000000, 0.0 },
581   { -0.090071811047659087, 10.000000000000000, 15.000000000000000, 0.0 },
582   { 0.18648255802394512, 10.000000000000000, 20.000000000000000, 0.0 },
583   { -0.075179843948523312, 10.000000000000000, 25.000000000000000, 0.0 },
584   { -0.12987689399858882, 10.000000000000000, 30.000000000000000, 0.0 },
585   { 0.063546391343962866, 10.000000000000000, 35.000000000000000, 0.0 },
586   { 0.11938336278226094, 10.000000000000000, 40.000000000000000, 0.0 },
587   { -0.026971402475010831, 10.000000000000000, 45.000000000000000, 0.0 },
588   { -0.11384784914946940, 10.000000000000000, 50.000000000000000, 0.0 },
589   { -0.015773790303746080, 10.000000000000000, 55.000000000000000, 0.0 },
590   { 0.097177143328071064, 10.000000000000000, 60.000000000000000, 0.0 },
591   { 0.054617389951112129, 10.000000000000000, 65.000000000000000, 0.0 },
592   { -0.065870338561952013, 10.000000000000000, 70.000000000000000, 0.0 },
593   { -0.080417867891894437, 10.000000000000000, 75.000000000000000, 0.0 },
594   { 0.024043850978184747, 10.000000000000000, 80.000000000000000, 0.0 },
595   { 0.086824832700067869, 10.000000000000000, 85.000000000000000, 0.0 },
596   { 0.019554748856312299, 10.000000000000000, 90.000000000000000, 0.0 },
597   { -0.072341598669443757, 10.000000000000000, 95.000000000000000, 0.0 },
598   { -0.054732176935472096, 10.000000000000000, 100.00000000000000, 0.0 },
599 };
600 const double toler023 = 2.5000000000000014e-11;
601 
602 // Test data for nu=20.000000000000000.
603 // max(|f - f_GSL|): 7.7212541915727684e-15 at index 15
604 // max(|f - f_GSL| / |f_GSL|): 1.1196544285022136e-12
605 // mean(f - f_GSL): 5.2156489342296849e-16
606 // variance(f - f_GSL): 3.4201480080426176e-31
607 // stddev(f - f_GSL): 5.8482031497226715e-16
608 const testcase_cyl_bessel_j<double>
609 data024[21] =
610 {
611   { 0.0000000000000000, 20.000000000000000, 0.0000000000000000, 0.0 },
612   { 2.7703300521289426e-11, 20.000000000000000, 5.0000000000000000, 0.0 },
613   { 1.1513369247813403e-05, 20.000000000000000, 10.000000000000000, 0.0 },
614   { 0.0073602340792234934, 20.000000000000000, 15.000000000000000, 0.0 },
615   { 0.16474777377532665, 20.000000000000000, 20.000000000000000, 0.0 },
616   { 0.051994049228303307, 20.000000000000000, 25.000000000000000, 0.0 },
617   { 0.0048310199934040923, 20.000000000000000, 30.000000000000000, 0.0 },
618   { -0.10927417397178038, 20.000000000000000, 35.000000000000000, 0.0 },
619   { 0.12779393355084889, 20.000000000000000, 40.000000000000000, 0.0 },
620   { 0.0047633437900313621, 20.000000000000000, 45.000000000000000, 0.0 },
621   { -0.11670435275957974, 20.000000000000000, 50.000000000000000, 0.0 },
622   { 0.025389204574566639, 20.000000000000000, 55.000000000000000, 0.0 },
623   { 0.10266020557876326, 20.000000000000000, 60.000000000000000, 0.0 },
624   { -0.023138582263434154, 20.000000000000000, 65.000000000000000, 0.0 },
625   { -0.096058573489952365, 20.000000000000000, 70.000000000000000, 0.0 },
626   { 0.0068961047221522270, 20.000000000000000, 75.000000000000000, 0.0 },
627   { 0.090565405489918357, 20.000000000000000, 80.000000000000000, 0.0 },
628   { 0.015985497599497172, 20.000000000000000, 85.000000000000000, 0.0 },
629   { -0.080345344044422534, 20.000000000000000, 90.000000000000000, 0.0 },
630   { -0.040253075701614051, 20.000000000000000, 95.000000000000000, 0.0 },
631   { 0.062217458498338672, 20.000000000000000, 100.00000000000000, 0.0 },
632 };
633 const double toler024 = 1.0000000000000006e-10;
634 
635 // Test data for nu=50.000000000000000.
636 // max(|f - f_GSL|): 6.6543992538470320e-15 at index 17
637 // max(|f - f_GSL| / |f_GSL|): 1.6466369526724007e-13
638 // mean(f - f_GSL): -1.7248164093189558e-16
639 // variance(f - f_GSL): 3.3098955753115488e-31
640 // stddev(f - f_GSL): 5.7531691921162455e-16
641 const testcase_cyl_bessel_j<double>
642 data025[21] =
643 {
644   { 0.0000000000000000, 50.000000000000000, 0.0000000000000000, 0.0 },
645   { 2.2942476159525415e-45, 50.000000000000000, 5.0000000000000000, 0.0 },
646   { 1.7845136078715964e-30, 50.000000000000000, 10.000000000000000, 0.0 },
647   { 6.1060519495338733e-22, 50.000000000000000, 15.000000000000000, 0.0 },
648   { 4.4510392847006872e-16, 50.000000000000000, 20.000000000000000, 0.0 },
649   { 9.7561594280229808e-12, 50.000000000000000, 25.000000000000000, 0.0 },
650   { 2.0581656631564172e-08, 50.000000000000000, 30.000000000000000, 0.0 },
651   { 7.6069951699272960e-06, 50.000000000000000, 35.000000000000000, 0.0 },
652   { 0.00068185243531768309, 50.000000000000000, 40.000000000000000, 0.0 },
653   { 0.017284343240791214, 50.000000000000000, 45.000000000000000, 0.0 },
654   { 0.12140902189761507, 50.000000000000000, 50.000000000000000, 0.0 },
655   { 0.13594720957176012, 50.000000000000000, 55.000000000000000, 0.0 },
656   { -0.13798273148535209, 50.000000000000000, 60.000000000000000, 0.0 },
657   { 0.12116217746619409, 50.000000000000000, 65.000000000000000, 0.0 },
658   { -0.11394866738787145, 50.000000000000000, 70.000000000000000, 0.0 },
659   { 0.094076799581573348, 50.000000000000000, 75.000000000000000, 0.0 },
660   { -0.039457764590251347, 50.000000000000000, 80.000000000000000, 0.0 },
661   { -0.040412060734136383, 50.000000000000000, 85.000000000000000, 0.0 },
662   { 0.090802099838032266, 50.000000000000000, 90.000000000000000, 0.0 },
663   { -0.055979156267280165, 50.000000000000000, 95.000000000000000, 0.0 },
664   { -0.038698339728525440, 50.000000000000000, 100.00000000000000, 0.0 },
665 };
666 const double toler025 = 1.0000000000000006e-11;
667 
668 // Test data for nu=100.00000000000000.
669 // max(|f - f_GSL|): 6.3751087742147661e-17 at index 18
670 // max(|f - f_GSL| / |f_GSL|): 1.3655432948759698e-13
671 // mean(f - f_GSL): -3.2198025339906150e-18
672 // variance(f - f_GSL): 7.7469087160903957e-35
673 // stddev(f - f_GSL): 8.8016525244356221e-18
674 const testcase_cyl_bessel_j<double>
675 data026[21] =
676 {
677   { 0.0000000000000000, 100.00000000000000, 0.0000000000000000, 0.0 },
678   { 6.2677893955418763e-119, 100.00000000000000, 5.0000000000000000, 0.0 },
679   { 6.5973160641553816e-89, 100.00000000000000, 10.000000000000000, 0.0 },
680   { 1.9660095611249536e-71, 100.00000000000000, 15.000000000000000, 0.0 },
681   { 3.9617550943362524e-59, 100.00000000000000, 20.000000000000000, 0.0 },
682   { 1.1064482655301687e-49, 100.00000000000000, 25.000000000000000, 0.0 },
683   { 4.5788015281752354e-42, 100.00000000000000, 30.000000000000000, 0.0 },
684   { 9.9210206714735426e-36, 100.00000000000000, 35.000000000000000, 0.0 },
685   { 2.3866062996026735e-30, 100.00000000000000, 40.000000000000000, 0.0 },
686   { 1.0329791804565538e-25, 100.00000000000000, 45.000000000000000, 0.0 },
687   { 1.1159273690838498e-21, 100.00000000000000, 50.000000000000000, 0.0 },
688   { 3.7899753451900944e-18, 100.00000000000000, 55.000000000000000, 0.0 },
689   { 4.7832744078782562e-15, 100.00000000000000, 60.000000000000000, 0.0 },
690   { 2.5375564579490428e-12, 100.00000000000000, 65.000000000000000, 0.0 },
691   { 6.1982452141641260e-10, 100.00000000000000, 70.000000000000000, 0.0 },
692   { 7.4479005905904457e-08, 100.00000000000000, 75.000000000000000, 0.0 },
693   { 4.6065530648234940e-06, 100.00000000000000, 80.000000000000000, 0.0 },
694   { 0.00015043869999501787, 100.00000000000000, 85.000000000000000, 0.0 },
695   { 0.0026021305819963628, 100.00000000000000, 90.000000000000000, 0.0 },
696   { 0.023150768009428030, 100.00000000000000, 95.000000000000000, 0.0 },
697   { 0.096366673295861571, 100.00000000000000, 100.00000000000000, 0.0 },
698 };
699 const double toler026 = 1.0000000000000006e-11;
700 
701 template<typename Ret, unsigned int Num>
702   void
test(const testcase_cyl_bessel_j<Ret> (& data)[Num],Ret toler)703   test(const testcase_cyl_bessel_j<Ret> (&data)[Num], Ret toler)
704   {
705     bool test __attribute__((unused)) = true;
706     const Ret eps = std::numeric_limits<Ret>::epsilon();
707     Ret max_abs_diff = -Ret(1);
708     Ret max_abs_frac = -Ret(1);
709     unsigned int num_datum = Num;
710     for (unsigned int i = 0; i < num_datum; ++i)
711       {
712 	const Ret f = std::cyl_bessel_j(data[i].nu, data[i].x);
713 	const Ret f0 = data[i].f0;
714 	const Ret diff = f - f0;
715 	if (std::abs(diff) > max_abs_diff)
716 	  max_abs_diff = std::abs(diff);
717 	if (std::abs(f0) > Ret(10) * eps
718 	 && std::abs(f) > Ret(10) * eps)
719 	  {
720 	    const Ret frac = diff / f0;
721 	    if (std::abs(frac) > max_abs_frac)
722 	      max_abs_frac = std::abs(frac);
723 	  }
724       }
725     VERIFY(max_abs_frac < toler);
726   }
727 
728 int
main()729 main()
730 {
731   test(data007, toler007);
732   test(data008, toler008);
733   test(data009, toler009);
734   test(data010, toler010);
735   test(data011, toler011);
736   test(data012, toler012);
737   test(data013, toler013);
738   test(data014, toler014);
739   test(data015, toler015);
740   test(data016, toler016);
741   test(data017, toler017);
742   test(data018, toler018);
743   test(data019, toler019);
744   test(data020, toler020);
745   test(data021, toler021);
746   test(data022, toler022);
747   test(data023, toler023);
748   test(data024, toler024);
749   test(data025, toler025);
750   test(data026, toler026);
751   return 0;
752 }
753