2017-03-14 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libstdc++-v3 / testsuite / special_functions / 07_cyl_bessel_i / check_value.cc
blob4de6fd01368ecbabf87d02752b11032876801478
1 // { dg-do run { target c++11 } }
2 // { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__" }
3 //
4 // Copyright (C) 2016-2017 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.
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.
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/>.
21 // cyl_bessel_i
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; \
35 #else
36 # include <testsuite_hooks.h>
37 #endif
38 #include <specfun_testcase.h>
41 // Test data for nu=0.0000000000000000.
42 // max(|f - f_GSL|): 2.8421709430404007e-14
43 // max(|f - f_GSL| / |f_GSL|): 1.3916073135966565e-15
44 const testcase_cyl_bessel_i<double>
45 data001[21] =
47 { 1.0000000000000000, 0.0000000000000000, 0.0000000000000000 },
48 { 1.0156861412236078, 0.0000000000000000, 0.25000000000000000 },
49 { 1.0634833707413236, 0.0000000000000000, 0.50000000000000000 },
50 { 1.1456467780440014, 0.0000000000000000, 0.75000000000000000 },
51 { 1.2660658777520082, 0.0000000000000000, 1.0000000000000000 },
52 { 1.4304687177218294, 0.0000000000000000, 1.2500000000000000 },
53 { 1.6467231897728904, 0.0000000000000000, 1.5000000000000000 },
54 { 1.9252521538585023, 0.0000000000000000, 1.7500000000000000 },
55 { 2.2795853023360668, 0.0000000000000000, 2.0000000000000000 },
56 { 2.7270783071907951, 0.0000000000000000, 2.2500000000000000 },
57 { 3.2898391440501231, 0.0000000000000000, 2.5000000000000000 },
58 { 3.9959131072376550, 0.0000000000000000, 2.7500000000000000 },
59 { 4.8807925858650245, 0.0000000000000000, 3.0000000000000000 },
60 { 5.9893359979395138, 0.0000000000000000, 3.2500000000000000 },
61 { 7.3782034322254750, 0.0000000000000000, 3.5000000000000000 },
62 { 9.1189458608445655, 0.0000000000000000, 3.7500000000000000 },
63 { 11.301921952136325, 0.0000000000000000, 4.0000000000000000 },
64 { 14.041263683000595, 0.0000000000000000, 4.2500000000000000 },
65 { 17.481171855609272, 0.0000000000000000, 4.5000000000000000 },
66 { 21.803898740902120, 0.0000000000000000, 4.7500000000000000 },
67 { 27.239871823604439, 0.0000000000000000, 5.0000000000000000 },
69 const double toler001 = 2.5000000000000020e-13;
71 // Test data for nu=0.33333333333333331.
72 // max(|f - f_GSL|): 1.0658141036401503e-14
73 // max(|f - f_GSL| / |f_GSL|): 1.1056193696204194e-15
74 const testcase_cyl_bessel_i<double>
75 data002[21] =
77 { 0.0000000000000000, 0.33333333333333331, 0.0000000000000000 },
78 { 0.56650686557808660, 0.33333333333333331, 0.25000000000000000 },
79 { 0.73897315642511863, 0.33333333333333331, 0.50000000000000000 },
80 { 0.89532320365836804, 0.33333333333333331, 0.75000000000000000 },
81 { 1.0646313978895285, 0.33333333333333331, 1.0000000000000000 },
82 { 1.2623776732605250, 0.33333333333333331, 1.2500000000000000 },
83 { 1.5014290000224382, 0.33333333333333331, 1.5000000000000000 },
84 { 1.7951195525946044, 0.33333333333333331, 1.7500000000000000 },
85 { 2.1587825813728614, 0.33333333333333331, 2.0000000000000000 },
86 { 2.6109134564811405, 0.33333333333333331, 2.2500000000000000 },
87 { 3.1743242297241938, 0.33333333333333331, 2.5000000000000000 },
88 { 3.8774551722182107, 0.33333333333333331, 2.7500000000000000 },
89 { 4.7559569371646946, 0.33333333333333331, 3.0000000000000000 },
90 { 5.8546499652731825, 0.33333333333333331, 3.2500000000000000 },
91 { 7.2299798619171147, 0.33333333333333331, 3.5000000000000000 },
92 { 8.9531114355506318, 0.33333333333333331, 3.7500000000000000 },
93 { 11.113838389991479, 0.33333333333333331, 4.0000000000000000 },
94 { 13.825531136529117, 0.33333333333333331, 4.2500000000000000 },
95 { 17.231403968478318, 0.33333333333333331, 4.5000000000000000 },
96 { 21.512458099556554, 0.33333333333333331, 4.7500000000000000 },
97 { 26.897553069268362, 0.33333333333333331, 5.0000000000000000 },
99 const double toler002 = 2.5000000000000020e-13;
101 // Test data for nu=0.50000000000000000.
102 // max(|f - f_GSL|): 1.4210854715202004e-14
103 // max(|f - f_GSL| / |f_GSL|): 1.2805693909168510e-15
104 const testcase_cyl_bessel_i<double>
105 data003[21] =
107 { 0.0000000000000000, 0.50000000000000000, 0.0000000000000000 },
108 { 0.40311093489975897, 0.50000000000000000, 0.25000000000000000 },
109 { 0.58799308679041573, 0.50000000000000000, 0.50000000000000000 },
110 { 0.75761498638991298, 0.50000000000000000, 0.75000000000000000 },
111 { 0.93767488824548695, 0.50000000000000000, 1.0000000000000000 },
112 { 1.1432089853159872, 0.50000000000000000, 1.2500000000000000 },
113 { 1.3871617204034761, 0.50000000000000000, 1.5000000000000000 },
114 { 1.6830217804556815, 0.50000000000000000, 1.7500000000000000 },
115 { 2.0462368630890526, 0.50000000000000000, 2.0000000000000000 },
116 { 2.4953405089360041, 0.50000000000000000, 2.2500000000000000 },
117 { 3.0530935381967175, 0.50000000000000000, 2.5000000000000000 },
118 { 3.7477882494879449, 0.50000000000000000, 2.7500000000000000 },
119 { 4.6148229034075969, 0.50000000000000000, 3.0000000000000000 },
120 { 5.6986505325335495, 0.50000000000000000, 3.2500000000000000 },
121 { 7.0552194086911877, 0.50000000000000000, 3.5000000000000000 },
122 { 8.7550467841188944, 0.50000000000000000, 3.7500000000000000 },
123 { 10.887101798588422, 0.50000000000000000, 4.0000000000000000 },
124 { 13.563718712579764, 0.50000000000000000, 4.2500000000000000 },
125 { 16.926820080158183, 0.50000000000000000, 4.5000000000000000 },
126 { 21.155804306570005, 0.50000000000000000, 4.7500000000000000 },
127 { 26.477547497559065, 0.50000000000000000, 5.0000000000000000 },
129 const double toler003 = 2.5000000000000020e-13;
131 // Test data for nu=0.66666666666666663.
132 // max(|f - f_GSL|): 1.2434497875801753e-14
133 // max(|f - f_GSL| / |f_GSL|): 1.3900778397944649e-15
134 const testcase_cyl_bessel_i<double>
135 data004[21] =
137 { 0.0000000000000000, 0.66666666666666663, 0.0000000000000000 },
138 { 0.27953690613200438, 0.66666666666666663, 0.25000000000000000 },
139 { 0.45628323113556879, 0.66666666666666663, 0.50000000000000000 },
140 { 0.62594569838182612, 0.66666666666666663, 0.75000000000000000 },
141 { 0.80752128860612948, 0.66666666666666663, 1.0000000000000000 },
142 { 1.0139484513577168, 0.66666666666666663, 1.2500000000000000 },
143 { 1.2572918396962991, 0.66666666666666663, 1.5000000000000000 },
144 { 1.5505806938325577, 0.66666666666666663, 1.7500000000000000 },
145 { 1.9089492968236206, 0.66666666666666663, 2.0000000000000000 },
146 { 2.3506463490300331, 0.66666666666666663, 2.2500000000000000 },
147 { 2.8981161894224892, 0.66666666666666663, 2.5000000000000000 },
148 { 3.5792654911068720, 0.66666666666666663, 2.7500000000000000 },
149 { 4.4290087213549505, 0.66666666666666663, 3.0000000000000000 },
150 { 5.4911895720097688, 0.66666666666666663, 3.2500000000000000 },
151 { 6.8209918044137305, 0.66666666666666663, 3.5000000000000000 },
152 { 8.4879784249619767, 0.66666666666666663, 3.7500000000000000 },
153 { 10.579932774013002, 0.66666666666666663, 4.0000000000000000 },
154 { 13.207720355482458, 0.66666666666666663, 4.2500000000000000 },
155 { 16.511448404200543, 0.66666666666666663, 4.5000000000000000 },
156 { 20.668274532832392, 0.66666666666666663, 4.7500000000000000 },
157 { 25.902310583215122, 0.66666666666666663, 5.0000000000000000 },
159 const double toler004 = 2.5000000000000020e-13;
161 // Test data for nu=1.0000000000000000.
162 // max(|f - f_GSL|): 3.5527136788005009e-15
163 // max(|f - f_GSL| / |f_GSL|): 2.2031887547040326e-16
164 const testcase_cyl_bessel_i<double>
165 data005[21] =
167 { 0.0000000000000000, 1.0000000000000000, 0.0000000000000000 },
168 { 0.12597910894546793, 1.0000000000000000, 0.25000000000000000 },
169 { 0.25789430539089631, 1.0000000000000000, 0.50000000000000000 },
170 { 0.40199246158092228, 1.0000000000000000, 0.75000000000000000 },
171 { 0.56515910399248503, 1.0000000000000000, 1.0000000000000000 },
172 { 0.75528141834074725, 1.0000000000000000, 1.2500000000000000 },
173 { 0.98166642857790720, 1.0000000000000000, 1.5000000000000000 },
174 { 1.2555375122401731, 1.0000000000000000, 1.7500000000000000 },
175 { 1.5906368546373291, 1.0000000000000000, 2.0000000000000000 },
176 { 2.0039674569295931, 1.0000000000000000, 2.2500000000000000 },
177 { 2.5167162452886984, 1.0000000000000000, 2.5000000000000000 },
178 { 3.1554101386190028, 1.0000000000000000, 2.7500000000000000 },
179 { 3.9533702174026097, 1.0000000000000000, 3.0000000000000000 },
180 { 4.9525461659085490, 1.0000000000000000, 3.2500000000000000 },
181 { 6.2058349222583642, 1.0000000000000000, 3.5000000000000000 },
182 { 7.7800152298244161, 1.0000000000000000, 3.7500000000000000 },
183 { 9.7594651537044488, 1.0000000000000000, 4.0000000000000000 },
184 { 12.250874667409304, 1.0000000000000000, 4.2500000000000000 },
185 { 15.389222753735924, 1.0000000000000000, 4.5000000000000000 },
186 { 19.345361447520226, 1.0000000000000000, 4.7500000000000000 },
187 { 24.335642142450524, 1.0000000000000000, 5.0000000000000000 },
189 const double toler005 = 2.5000000000000020e-13;
191 // Test data for nu=2.0000000000000000.
192 // max(|f - f_GSL|): 1.7763568394002505e-15
193 // max(|f - f_GSL| / |f_GSL|): 2.2089187702829171e-16
194 const testcase_cyl_bessel_i<double>
195 data006[21] =
197 { 0.0000000000000000, 2.0000000000000000, 0.0000000000000000 },
198 { 0.0078532696598645167, 2.0000000000000000, 0.25000000000000000 },
199 { 0.031906149177738249, 2.0000000000000000, 0.50000000000000000 },
200 { 0.073666880494875436, 2.0000000000000000, 0.75000000000000000 },
201 { 0.13574766976703831, 2.0000000000000000, 1.0000000000000000 },
202 { 0.22201844837663415, 2.0000000000000000, 1.2500000000000000 },
203 { 0.33783461833568068, 2.0000000000000000, 1.5000000000000000 },
204 { 0.49035213986973319, 2.0000000000000000, 1.7500000000000000 },
205 { 0.68894844769873831, 2.0000000000000000, 2.0000000000000000 },
206 { 0.94577390103115722, 2.0000000000000000, 2.2500000000000000 },
207 { 1.2764661478191643, 2.0000000000000000, 2.5000000000000000 },
208 { 1.7010693700601991, 2.0000000000000000, 2.7500000000000000 },
209 { 2.2452124409299512, 2.0000000000000000, 3.0000000000000000 },
210 { 2.9416152804573357, 2.0000000000000000, 3.2500000000000000 },
211 { 3.8320120480778415, 2.0000000000000000, 3.5000000000000000 },
212 { 4.9696044049382113, 2.0000000000000000, 3.7500000000000000 },
213 { 6.4221893752841046, 2.0000000000000000, 4.0000000000000000 },
214 { 8.2761461924550552, 2.0000000000000000, 4.2500000000000000 },
215 { 10.641517298393307, 2.0000000000000000, 4.5000000000000000 },
216 { 13.658483394577813, 2.0000000000000000, 4.7500000000000000 },
217 { 17.505614966624233, 2.0000000000000000, 5.0000000000000000 },
219 const double toler006 = 2.5000000000000020e-13;
221 // Test data for nu=5.0000000000000000.
222 // max(|f - f_GSL|): 8.8817841970012523e-16
223 // max(|f - f_GSL| / |f_GSL|): 1.6610041744866592e-15
224 const testcase_cyl_bessel_i<double>
225 data007[21] =
227 { 0.0000000000000000, 5.0000000000000000, 0.0000000000000000 },
228 { 2.5497616449882785e-07, 5.0000000000000000, 0.25000000000000000 },
229 { 8.2231713131092646e-06, 5.0000000000000000, 0.50000000000000000 },
230 { 6.3261122739811725e-05, 5.0000000000000000, 0.75000000000000000 },
231 { 0.00027146315595697195, 5.0000000000000000, 1.0000000000000000 },
232 { 0.00084793613616686856, 5.0000000000000000, 1.2500000000000000 },
233 { 0.0021705595690975554, 5.0000000000000000, 1.5000000000000000 },
234 { 0.0048504513371845394, 5.0000000000000000, 1.7500000000000000 },
235 { 0.0098256793231317023, 5.0000000000000000, 2.0000000000000000 },
236 { 0.018486577941045829, 5.0000000000000000, 2.2500000000000000 },
237 { 0.032843475172023219, 5.0000000000000000, 2.5000000000000000 },
238 { 0.055750882754221943, 5.0000000000000000, 2.7500000000000000 },
239 { 0.091206477661513338, 5.0000000000000000, 3.0000000000000000 },
240 { 0.14474880546308083, 5.0000000000000000, 3.2500000000000000 },
241 { 0.22398495470190780, 5.0000000000000000, 3.5000000000000000 },
242 { 0.33928899170999866, 5.0000000000000000, 3.7500000000000000 },
243 { 0.50472436311316626, 5.0000000000000000, 4.0000000000000000 },
244 { 0.73925961816682961, 5.0000000000000000, 4.2500000000000000 },
245 { 1.0683677743764699, 5.0000000000000000, 4.5000000000000000 },
246 { 1.5261268693599621, 5.0000000000000000, 4.7500000000000000 },
247 { 2.1579745473225476, 5.0000000000000000, 5.0000000000000000 },
249 const double toler007 = 2.5000000000000020e-13;
251 // Test data for nu=10.000000000000000.
252 // max(|f - f_GSL|): 9.5409791178724390e-18
253 // max(|f - f_GSL| / |f_GSL|): 3.9173270279899483e-15
254 const testcase_cyl_bessel_i<double>
255 data008[21] =
257 { 0.0000000000000000, 10.000000000000000, 0.0000000000000000 },
258 { 2.5701232848571186e-16, 10.000000000000000, 0.25000000000000000 },
259 { 2.6430419258812784e-13, 10.000000000000000, 0.50000000000000000 },
260 { 1.5349659676120412e-11, 10.000000000000000, 0.75000000000000000 },
261 { 2.7529480398368732e-10, 10.000000000000000, 1.0000000000000000 },
262 { 2.5967897782035928e-09, 10.000000000000000, 1.2500000000000000 },
263 { 1.6330924437799743e-08, 10.000000000000000, 1.5000000000000000 },
264 { 7.7706676834614093e-08, 10.000000000000000, 1.7500000000000000 },
265 { 3.0169638793506839e-07, 10.000000000000000, 2.0000000000000000 },
266 { 1.0034459057774481e-06, 10.000000000000000, 2.2500000000000000 },
267 { 2.9557436109680578e-06, 10.000000000000000, 2.5000000000000000 },
268 { 7.8955603774082724e-06, 10.000000000000000, 2.7500000000000000 },
269 { 1.9464393470612970e-05, 10.000000000000000, 3.0000000000000000 },
270 { 4.4875369479742435e-05, 10.000000000000000, 3.2500000000000000 },
271 { 9.7760848514528916e-05, 10.000000000000000, 3.5000000000000000 },
272 { 0.00020289011210063493, 10.000000000000000, 3.7500000000000000 },
273 { 0.00040378896132693047, 10.000000000000000, 4.0000000000000000 },
274 { 0.00077478519551669892, 10.000000000000000, 4.2500000000000000 },
275 { 0.0014397060684919682, 10.000000000000000, 4.5000000000000000 },
276 { 0.0026004486016189452, 10.000000000000000, 4.7500000000000000 },
277 { 0.0045800444191760525, 10.000000000000000, 5.0000000000000000 },
279 const double toler008 = 2.5000000000000020e-13;
281 // Test data for nu=20.000000000000000.
282 // max(|f - f_GSL|): 2.9080568410067379e-26
283 // max(|f - f_GSL| / |f_GSL|): 2.1318627676504474e-15
284 const testcase_cyl_bessel_i<double>
285 data009[21] =
287 { 0.0000000000000000, 20.000000000000000, 0.0000000000000000 },
288 { 3.5677858077910353e-37, 20.000000000000000, 0.25000000000000000 },
289 { 3.7494538480790194e-31, 20.000000000000000, 0.50000000000000000 },
290 { 1.2514356342425337e-27, 20.000000000000000, 0.75000000000000000 },
291 { 3.9668359858190197e-25, 20.000000000000000, 1.0000000000000000 },
292 { 3.4637832909868234e-23, 20.000000000000000, 1.2500000000000000 },
293 { 1.3388331839683472e-21, 20.000000000000000, 1.5000000000000000 },
294 { 2.9502376732679751e-20, 20.000000000000000, 1.7500000000000000 },
295 { 4.3105605761095479e-19, 20.000000000000000, 2.0000000000000000 },
296 { 4.6032451406433059e-18, 20.000000000000000, 2.2500000000000000 },
297 { 3.8400317244170310e-17, 20.000000000000000, 2.5000000000000000 },
298 { 2.6239115263043263e-16, 20.000000000000000, 2.7500000000000000 },
299 { 1.5209660019426689e-15, 20.000000000000000, 3.0000000000000000 },
300 { 7.6806450728249953e-15, 20.000000000000000, 3.2500000000000000 },
301 { 3.4495528847222945e-14, 20.000000000000000, 3.5000000000000000 },
302 { 1.4006589294850672e-13, 20.000000000000000, 3.7500000000000000 },
303 { 5.2100734221993044e-13, 20.000000000000000, 4.0000000000000000 },
304 { 1.7946903269488168e-12, 20.000000000000000, 4.2500000000000000 },
305 { 5.7763830562279683e-12, 20.000000000000000, 4.5000000000000000 },
306 { 1.7502433074548735e-11, 20.000000000000000, 4.7500000000000000 },
307 { 5.0242393579718066e-11, 20.000000000000000, 5.0000000000000000 },
309 const double toler009 = 2.5000000000000020e-13;
310 // cyl_bessel_i
312 // Test data for nu=0.0000000000000000.
313 // max(|f - f_GSL|): 2.5687255815171641e+28
314 // max(|f - f_GSL| / |f_GSL|): 2.3922901025046178e-14
315 const testcase_cyl_bessel_i<double>
316 data010[21] =
318 { 1.0000000000000000, 0.0000000000000000, 0.0000000000000000 },
319 { 27.239871823604439, 0.0000000000000000, 5.0000000000000000 },
320 { 2815.7166284662558, 0.0000000000000000, 10.000000000000000 },
321 { 339649.37329791381, 0.0000000000000000, 15.000000000000000 },
322 { 43558282.559553474, 0.0000000000000000, 20.000000000000000 },
323 { 5774560606.4663124, 0.0000000000000000, 25.000000000000000 },
324 { 781672297823.97925, 0.0000000000000000, 30.000000000000000 },
325 { 107338818494514.42, 0.0000000000000000, 35.000000000000000 },
326 { 14894774793419918., 0.0000000000000000, 40.000000000000000 },
327 { 2.0834140751773164e+18, 0.0000000000000000, 45.000000000000000 },
328 { 2.9325537838493457e+20, 0.0000000000000000, 50.000000000000000 },
329 { 4.1487895607332160e+22, 0.0000000000000000, 55.000000000000000 },
330 { 5.8940770556098216e+24, 0.0000000000000000, 60.000000000000000 },
331 { 8.4030398456255596e+26, 0.0000000000000000, 65.000000000000000 },
332 { 1.2015889579125424e+29, 0.0000000000000000, 70.000000000000000 },
333 { 1.7226390780357976e+31, 0.0000000000000000, 75.000000000000000 },
334 { 2.4751784043341661e+33, 0.0000000000000000, 80.000000000000000 },
335 { 3.5634776304081403e+35, 0.0000000000000000, 85.000000000000000 },
336 { 5.1392383455086475e+37, 0.0000000000000000, 90.000000000000000 },
337 { 7.4233258618752072e+39, 0.0000000000000000, 95.000000000000000 },
338 { 1.0737517071310986e+42, 0.0000000000000000, 100.00000000000000 },
340 const double toler010 = 2.5000000000000015e-12;
342 // Test data for nu=0.33333333333333331.
343 // max(|f - f_GSL|): 1.0831975343747077e+28
344 // max(|f - f_GSL| / |f_GSL|): 1.2017640663876795e-14
345 const testcase_cyl_bessel_i<double>
346 data011[21] =
348 { 0.0000000000000000, 0.33333333333333331, 0.0000000000000000 },
349 { 26.897553069268362, 0.33333333333333331, 5.0000000000000000 },
350 { 2799.2396097056790, 0.33333333333333331, 10.000000000000000 },
351 { 338348.63146593666, 0.33333333333333331, 15.000000000000000 },
352 { 43434263.927938424, 0.33333333333333331, 20.000000000000000 },
353 { 5761474759.6213636, 0.33333333333333331, 25.000000000000000 },
354 { 780201111830.30237, 0.33333333333333331, 30.000000000000000 },
355 { 107166066959051.91, 0.33333333333333331, 35.000000000000000 },
356 { 14873836574083764., 0.33333333333333331, 40.000000000000000 },
357 { 2.0808143020217085e+18, 0.33333333333333331, 45.000000000000000 },
358 { 2.9292639365644226e+20, 0.33333333333333331, 50.000000000000000 },
359 { 4.1445621624120489e+22, 0.33333333333333331, 55.000000000000000 },
360 { 5.8885758374365916e+24, 0.33333333333333331, 60.000000000000000 },
361 { 8.3958047021083955e+26, 0.33333333333333331, 65.000000000000000 },
362 { 1.2006287819446431e+29, 0.33333333333333331, 70.000000000000000 },
363 { 1.7213548977150022e+31, 0.33333333333333331, 75.000000000000000 },
364 { 2.4734492458444449e+33, 0.33333333333333331, 80.000000000000000 },
365 { 3.5611354547857122e+35, 0.33333333333333331, 85.000000000000000 },
366 { 5.1360491295551848e+37, 0.33333333333333331, 90.000000000000000 },
367 { 7.4189629097600431e+39, 0.33333333333333331, 95.000000000000000 },
368 { 1.0731523308358370e+42, 0.33333333333333331, 100.00000000000000 },
370 const double toler011 = 1.0000000000000008e-12;
372 // Test data for nu=0.50000000000000000.
373 // max(|f - f_GSL|): 6.9634127209802640e+27
374 // max(|f - f_GSL| / |f_GSL|): 1.1904152155149629e-14
375 const testcase_cyl_bessel_i<double>
376 data012[21] =
378 { 0.0000000000000000, 0.50000000000000000, 0.0000000000000000 },
379 { 26.477547497559065, 0.50000000000000000, 5.0000000000000000 },
380 { 2778.7846038745711, 0.50000000000000000, 10.000000000000000 },
381 { 336729.88718706399, 0.50000000000000000, 15.000000000000000 },
382 { 43279746.272428922, 0.50000000000000000, 20.000000000000000 },
383 { 5745159748.3464680, 0.50000000000000000, 25.000000000000000 },
384 { 778366068840.44580, 0.50000000000000000, 30.000000000000000 },
385 { 106950522408567.66, 0.50000000000000000, 35.000000000000000 },
386 { 14847705549021962., 0.50000000000000000, 40.000000000000000 },
387 { 2.0775691824625661e+18, 0.50000000000000000, 45.000000000000000 },
388 { 2.9251568529912984e+20, 0.50000000000000000, 50.000000000000000 },
389 { 4.1392840094781220e+22, 0.50000000000000000, 55.000000000000000 },
390 { 5.8817065760751945e+24, 0.50000000000000000, 60.000000000000000 },
391 { 8.3867695787277258e+26, 0.50000000000000000, 65.000000000000000 },
392 { 1.1994296461653203e+29, 0.50000000000000000, 70.000000000000000 },
393 { 1.7197510246063334e+31, 0.50000000000000000, 75.000000000000000 },
394 { 2.4712895036230794e+33, 0.50000000000000000, 80.000000000000000 },
395 { 3.5582099086757769e+35, 0.50000000000000000, 85.000000000000000 },
396 { 5.1320654031231128e+37, 0.50000000000000000, 90.000000000000000 },
397 { 7.4135128383495239e+39, 0.50000000000000000, 95.000000000000000 },
398 { 1.0724035825423179e+42, 0.50000000000000000, 100.00000000000000 },
400 const double toler012 = 1.0000000000000008e-12;
402 // Test data for nu=0.66666666666666663.
403 // max(|f - f_GSL|): 4.4875326424095035e+27
404 // max(|f - f_GSL| / |f_GSL|): 8.8432218147527708e-15
405 const testcase_cyl_bessel_i<double>
406 data013[21] =
408 { 0.0000000000000000, 0.66666666666666663, 0.0000000000000000 },
409 { 25.902310583215122, 0.66666666666666663, 5.0000000000000000 },
410 { 2750.4090423459315, 0.66666666666666663, 10.000000000000000 },
411 { 334476.98138574377, 0.66666666666666663, 15.000000000000000 },
412 { 43064361.686912313, 0.66666666666666663, 20.000000000000000 },
413 { 5722397441.9603882, 0.66666666666666663, 25.000000000000000 },
414 { 775804343498.02661, 0.66666666666666663, 30.000000000000000 },
415 { 106649495512800.88, 0.66666666666666663, 35.000000000000000 },
416 { 14811199896983756., 0.66666666666666663, 40.000000000000000 },
417 { 2.0730345814356961e+18, 0.66666666666666663, 45.000000000000000 },
418 { 2.9194166755257467e+20, 0.66666666666666663, 50.000000000000000 },
419 { 4.1319059569935374e+22, 0.66666666666666663, 55.000000000000000 },
420 { 5.8721031476386222e+24, 0.66666666666666663, 60.000000000000000 },
421 { 8.3741368248217844e+26, 0.66666666666666663, 65.000000000000000 },
422 { 1.1977528777008688e+29, 0.66666666666666663, 70.000000000000000 },
423 { 1.7175081240014333e+31, 0.66666666666666663, 75.000000000000000 },
424 { 2.4682690458513916e+33, 0.66666666666666663, 80.000000000000000 },
425 { 3.5541181975850724e+35, 0.66666666666666663, 85.000000000000000 },
426 { 5.1264933963228892e+37, 0.66666666666666663, 90.000000000000000 },
427 { 7.4058894880134064e+39, 0.66666666666666663, 95.000000000000000 },
428 { 1.0713562154788124e+42, 0.66666666666666663, 100.00000000000000 },
430 const double toler013 = 5.0000000000000039e-13;
432 // Test data for nu=1.0000000000000000.
433 // max(|f - f_GSL|): 5.7254726816948838e+27
434 // max(|f - f_GSL| / |f_GSL|): 7.0819761463168391e-15
435 const testcase_cyl_bessel_i<double>
436 data014[21] =
438 { 0.0000000000000000, 1.0000000000000000, 0.0000000000000000 },
439 { 24.335642142450524, 1.0000000000000000, 5.0000000000000000 },
440 { 2670.9883037012560, 1.0000000000000000, 10.000000000000000 },
441 { 328124.92197020649, 1.0000000000000000, 15.000000000000000 },
442 { 42454973.385127783, 1.0000000000000000, 20.000000000000000 },
443 { 5657865129.8787022, 1.0000000000000000, 25.000000000000000 },
444 { 768532038938.95667, 1.0000000000000000, 30.000000000000000 },
445 { 105794126051896.17, 1.0000000000000000, 35.000000000000000 },
446 { 14707396163259354., 1.0000000000000000, 40.000000000000000 },
447 { 2.0601334620815780e+18, 1.0000000000000000, 45.000000000000000 },
448 { 2.9030785901035638e+20, 1.0000000000000000, 50.000000000000000 },
449 { 4.1108986452992812e+22, 1.0000000000000000, 55.000000000000000 },
450 { 5.8447515883904527e+24, 1.0000000000000000, 60.000000000000000 },
451 { 8.3381485471501302e+26, 1.0000000000000000, 65.000000000000000 },
452 { 1.1929750788892366e+29, 1.0000000000000000, 70.000000000000000 },
453 { 1.7111160152965382e+31, 1.0000000000000000, 75.000000000000000 },
454 { 2.4596595795675343e+33, 1.0000000000000000, 80.000000000000000 },
455 { 3.5424536064404024e+35, 1.0000000000000000, 85.000000000000000 },
456 { 5.1106068152566129e+37, 1.0000000000000000, 90.000000000000000 },
457 { 7.3841518091360182e+39, 1.0000000000000000, 95.000000000000000 },
458 { 1.0683693903381569e+42, 1.0000000000000000, 100.00000000000000 },
460 const double toler014 = 5.0000000000000039e-13;
462 // Test data for nu=2.0000000000000000.
463 // max(|f - f_GSL|): 6.3444427013375739e+27
464 // max(|f - f_GSL| / |f_GSL|): 6.0286366727804324e-15
465 const testcase_cyl_bessel_i<double>
466 data015[21] =
468 { 0.0000000000000000, 2.0000000000000000, 0.0000000000000000 },
469 { 17.505614966624233, 2.0000000000000000, 5.0000000000000000 },
470 { 2281.5189677260046, 2.0000000000000000, 10.000000000000000 },
471 { 295899.38370188628, 2.0000000000000000, 15.000000000000000 },
472 { 39312785.221040756, 2.0000000000000000, 20.000000000000000 },
473 { 5321931396.0760155, 2.0000000000000000, 25.000000000000000 },
474 { 730436828561.38013, 2.0000000000000000, 30.000000000000000 },
475 { 101293439862977.19, 2.0000000000000000, 35.000000000000000 },
476 { 14159404985256922., 2.0000000000000000, 40.000000000000000 },
477 { 1.9918525879736883e+18, 2.0000000000000000, 45.000000000000000 },
478 { 2.8164306402451938e+20, 2.0000000000000000, 50.000000000000000 },
479 { 3.9993023372677540e+22, 2.0000000000000000, 55.000000000000000 },
480 { 5.6992520026634433e+24, 2.0000000000000000, 60.000000000000000 },
481 { 8.1464814287900378e+26, 2.0000000000000000, 65.000000000000000 },
482 { 1.1675039556585663e+29, 2.0000000000000000, 70.000000000000000 },
483 { 1.6770093176278926e+31, 2.0000000000000000, 75.000000000000000 },
484 { 2.4136869148449879e+33, 2.0000000000000000, 80.000000000000000 },
485 { 3.4801257808448186e+35, 2.0000000000000000, 85.000000000000000 },
486 { 5.0256693051696307e+37, 2.0000000000000000, 90.000000000000000 },
487 { 7.2678700343145818e+39, 2.0000000000000000, 95.000000000000000 },
488 { 1.0523843193243042e+42, 2.0000000000000000, 100.00000000000000 },
490 const double toler015 = 5.0000000000000039e-13;
492 // Test data for nu=5.0000000000000000.
493 // max(|f - f_GSL|): 7.7371252455336267e+26
494 // max(|f - f_GSL| / |f_GSL|): 1.6729319922562276e-15
495 const testcase_cyl_bessel_i<double>
496 data016[21] =
498 { 0.0000000000000000, 5.0000000000000000, 0.0000000000000000 },
499 { 2.1579745473225476, 5.0000000000000000, 5.0000000000000000 },
500 { 777.18828640326012, 5.0000000000000000, 10.000000000000000 },
501 { 144572.01120063409, 5.0000000000000000, 15.000000000000000 },
502 { 23018392.213413671, 5.0000000000000000, 20.000000000000000 },
503 { 3472466208.7419176, 5.0000000000000000, 25.000000000000000 },
504 { 512151465476.93494, 5.0000000000000000, 30.000000000000000 },
505 { 74756743552251.547, 5.0000000000000000, 35.000000000000000 },
506 { 10858318337624280., 5.0000000000000000, 40.000000000000000 },
507 { 1.5736087399245911e+18, 5.0000000000000000, 45.000000000000000 },
508 { 2.2785483079112825e+20, 5.0000000000000000, 50.000000000000000 },
509 { 3.2989391052963687e+22, 5.0000000000000000, 55.000000000000000 },
510 { 4.7777652072561732e+24, 5.0000000000000000, 60.000000000000000 },
511 { 6.9232165147172657e+26, 5.0000000000000000, 65.000000000000000 },
512 { 1.0038643002095155e+29, 5.0000000000000000, 70.000000000000000 },
513 { 1.4566328222327073e+31, 5.0000000000000000, 75.000000000000000 },
514 { 2.1151488565944835e+33, 5.0000000000000000, 80.000000000000000 },
515 { 3.0735883450768239e+35, 5.0000000000000000, 85.000000000000000 },
516 { 4.4694790189230327e+37, 5.0000000000000000, 90.000000000000000 },
517 { 6.5037505570430995e+39, 5.0000000000000000, 95.000000000000000 },
518 { 9.4700938730355882e+41, 5.0000000000000000, 100.00000000000000 },
520 const double toler016 = 2.5000000000000020e-13;
522 // Test data for nu=10.000000000000000.
523 // max(|f - f_GSL|): 2.3211375736600880e+26
524 // max(|f - f_GSL| / |f_GSL|): 3.0834307473515225e-15
525 const testcase_cyl_bessel_i<double>
526 data017[21] =
528 { 0.0000000000000000, 10.000000000000000, 0.0000000000000000 },
529 { 0.0045800444191760525, 10.000000000000000, 5.0000000000000000 },
530 { 21.891706163723381, 10.000000000000000, 10.000000000000000 },
531 { 12267.475049806462, 10.000000000000000, 15.000000000000000 },
532 { 3540200.2090195213, 10.000000000000000, 20.000000000000000 },
533 { 771298871.17072666, 10.000000000000000, 25.000000000000000 },
534 { 145831809975.96710, 10.000000000000000, 30.000000000000000 },
535 { 25449470018534.777, 10.000000000000000, 35.000000000000000 },
536 { 4228469210516757.5, 10.000000000000000, 40.000000000000000 },
537 { 6.8049404557505165e+17, 10.000000000000000, 45.000000000000000 },
538 { 1.0715971594776370e+20, 10.000000000000000, 50.000000000000000 },
539 { 1.6618215752886714e+22, 10.000000000000000, 55.000000000000000 },
540 { 2.5486246072566784e+24, 10.000000000000000, 60.000000000000000 },
541 { 3.8764628702155481e+26, 10.000000000000000, 65.000000000000000 },
542 { 5.8592538145409686e+28, 10.000000000000000, 70.000000000000000 },
543 { 8.8135370711317444e+30, 10.000000000000000, 75.000000000000000 },
544 { 1.3207418268325279e+33, 10.000000000000000, 80.000000000000000 },
545 { 1.9732791360862190e+35, 10.000000000000000, 85.000000000000000 },
546 { 2.9411893748384672e+37, 10.000000000000000, 90.000000000000000 },
547 { 4.3754494922439984e+39, 10.000000000000000, 95.000000000000000 },
548 { 6.4989755247201446e+41, 10.000000000000000, 100.00000000000000 },
550 const double toler017 = 2.5000000000000020e-13;
552 // Test data for nu=20.000000000000000.
553 // max(|f - f_GSL|): 1.9342813113834067e+25
554 // max(|f - f_GSL| / |f_GSL|): 4.7061265485304859e-15
555 const testcase_cyl_bessel_i<double>
556 data018[21] =
558 { 0.0000000000000000, 20.000000000000000, 0.0000000000000000 },
559 { 5.0242393579718066e-11, 20.000000000000000, 5.0000000000000000 },
560 { 0.00012507997356449481, 20.000000000000000, 10.000000000000000 },
561 { 1.6470152535015836, 20.000000000000000, 15.000000000000000 },
562 { 3188.7503288536154, 20.000000000000000, 20.000000000000000 },
563 { 2449840.5422952301, 20.000000000000000, 25.000000000000000 },
564 { 1126985104.4483771, 20.000000000000000, 30.000000000000000 },
565 { 379617876611.88580, 20.000000000000000, 35.000000000000000 },
566 { 104459633129479.89, 20.000000000000000, 40.000000000000000 },
567 { 25039579987216524., 20.000000000000000, 45.000000000000000 },
568 { 5.4420084027529984e+18, 20.000000000000000, 50.000000000000000 },
569 { 1.1007498584335495e+21, 20.000000000000000, 55.000000000000000 },
570 { 2.1091734863057236e+23, 20.000000000000000, 60.000000000000000 },
571 { 3.8763618091286899e+25, 20.000000000000000, 65.000000000000000 },
572 { 6.8946130527930870e+27, 20.000000000000000, 70.000000000000000 },
573 { 1.1946319948836447e+30, 20.000000000000000, 75.000000000000000 },
574 { 2.0265314377577587e+32, 20.000000000000000, 80.000000000000000 },
575 { 3.3784665214179985e+34, 20.000000000000000, 85.000000000000000 },
576 { 5.5516089411796646e+36, 20.000000000000000, 90.000000000000000 },
577 { 9.0129310795305151e+38, 20.000000000000000, 95.000000000000000 },
578 { 1.4483461256427176e+41, 20.000000000000000, 100.00000000000000 },
580 const double toler018 = 2.5000000000000020e-13;
582 // Test data for nu=50.000000000000000.
583 // max(|f - f_GSL|): 4.5452777397620335e+22
584 // max(|f - f_GSL| / |f_GSL|): 6.0191728870880627e-14
585 const testcase_cyl_bessel_i<double>
586 data019[21] =
588 { 0.0000000000000000, 50.000000000000000, 0.0000000000000000 },
589 { 2.9314696468108517e-45, 50.000000000000000, 5.0000000000000000 },
590 { 4.7568945607268442e-30, 50.000000000000000, 10.000000000000000 },
591 { 5.5468372730667069e-21, 50.000000000000000, 15.000000000000000 },
592 { 2.2551205757604056e-14, 50.000000000000000, 20.000000000000000 },
593 { 4.5344251866130257e-09, 50.000000000000000, 25.000000000000000 },
594 { 0.00014590106916468940, 50.000000000000000, 30.000000000000000 },
595 { 1.3965549457254882, 50.000000000000000, 35.000000000000000 },
596 { 5726.8656631289896, 50.000000000000000, 40.000000000000000 },
597 { 12672593.113027781, 50.000000000000000, 45.000000000000000 },
598 { 17650802430.016712, 50.000000000000000, 50.000000000000000 },
599 { 17220231607789.926, 50.000000000000000, 55.000000000000000 },
600 { 12704607933652176., 50.000000000000000, 60.000000000000000 },
601 { 7.4989491942193725e+18, 50.000000000000000, 65.000000000000000 },
602 { 3.6944034898904922e+21, 50.000000000000000, 70.000000000000000 },
603 { 1.5691634774370186e+24, 50.000000000000000, 75.000000000000000 },
604 { 5.8927749458163587e+26, 50.000000000000000, 80.000000000000000 },
605 { 1.9958849054749339e+29, 50.000000000000000, 85.000000000000000 },
606 { 6.1946050361781500e+31, 50.000000000000000, 90.000000000000000 },
607 { 1.7845429728697119e+34, 50.000000000000000, 95.000000000000000 },
608 { 4.8219580855940819e+36, 50.000000000000000, 100.00000000000000 },
610 const double toler019 = 5.0000000000000029e-12;
612 // Test data for nu=100.00000000000000.
613 // max(|f - f_GSL|): 186646528.00000000
614 // max(|f - f_GSL| / |f_GSL|): 2.8278213985558577e-13
615 const testcase_cyl_bessel_i<double>
616 data020[21] =
618 { 0.0000000000000000, 100.00000000000000, 0.0000000000000000 },
619 { 7.0935514885313123e-119, 100.00000000000000, 5.0000000000000000 },
620 { 1.0823442017492018e-88, 100.00000000000000, 10.000000000000000 },
621 { 5.9887888536468904e-71, 100.00000000000000, 15.000000000000000 },
622 { 2.8703193216428771e-58, 100.00000000000000, 20.000000000000000 },
623 { 2.4426896913122370e-48, 100.00000000000000, 25.000000000000000 },
624 { 3.9476420053334271e-40, 100.00000000000000, 30.000000000000000 },
625 { 4.2836596180818780e-33, 100.00000000000000, 35.000000000000000 },
626 { 6.6249380222596129e-27, 100.00000000000000, 40.000000000000000 },
627 { 2.3702587262788900e-21, 100.00000000000000, 45.000000000000000 },
628 { 2.7278879470966917e-16, 100.00000000000000, 50.000000000000000 },
629 { 1.2763258878228082e-11, 100.00000000000000, 55.000000000000000 },
630 { 2.8832770906491972e-07, 100.00000000000000, 60.000000000000000 },
631 { 0.0035805902717061227, 100.00000000000000, 65.000000000000000 },
632 { 27.017219102595387, 100.00000000000000, 70.000000000000000 },
633 { 134001.44891209516, 100.00000000000000, 75.000000000000000 },
634 { 465194832.85060996, 100.00000000000000, 80.000000000000000 },
635 { 1189280653119.4814, 100.00000000000000, 85.000000000000000 },
636 { 2334119331258728.0, 100.00000000000000, 90.000000000000000 },
637 { 3.6399223078502436e+18, 100.00000000000000, 95.000000000000000 },
638 { 4.6415349416162005e+21, 100.00000000000000, 100.00000000000000 },
640 const double toler020 = 2.5000000000000014e-11;
642 template<typename Tp, unsigned int Num>
643 void
644 test(const testcase_cyl_bessel_i<Tp> (&data)[Num], Tp toler)
646 const Tp eps = std::numeric_limits<Tp>::epsilon();
647 Tp max_abs_diff = -Tp(1);
648 Tp max_abs_frac = -Tp(1);
649 unsigned int num_datum = Num;
650 for (unsigned int i = 0; i < num_datum; ++i)
652 const Tp f = std::cyl_bessel_i(data[i].nu, data[i].x);
653 const Tp f0 = data[i].f0;
654 const Tp diff = f - f0;
655 if (std::abs(diff) > max_abs_diff)
656 max_abs_diff = std::abs(diff);
657 if (std::abs(f0) > Tp(10) * eps
658 && std::abs(f) > Tp(10) * eps)
660 const Tp frac = diff / f0;
661 if (std::abs(frac) > max_abs_frac)
662 max_abs_frac = std::abs(frac);
665 VERIFY(max_abs_frac < toler);
669 main()
671 test(data001, toler001);
672 test(data002, toler002);
673 test(data003, toler003);
674 test(data004, toler004);
675 test(data005, toler005);
676 test(data006, toler006);
677 test(data007, toler007);
678 test(data008, toler008);
679 test(data009, toler009);
680 test(data010, toler010);
681 test(data011, toler011);
682 test(data012, toler012);
683 test(data013, toler013);
684 test(data014, toler014);
685 test(data015, toler015);
686 test(data016, toler016);
687 test(data017, toler017);
688 test(data018, toler018);
689 test(data019, toler019);
690 test(data020, toler020);
691 return 0;