]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/special_functions/08_cyl_bessel_j/check_value.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / special_functions / 08_cyl_bessel_j / check_value.cc
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.
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
41 // Test data for nu=0.0000000000000000.
42 // max(|f - f_GSL|): 1.6653345369377348e-16
43 // max(|f - f_GSL| / |f_GSL|): 6.5276306654894409e-16
44 const testcase_cyl_bessel_j<double>
45 data001[21] =
46 {
47 { 1.0000000000000000, 0.0000000000000000, 0.0000000000000000 },
48 { 0.98443592929585266, 0.0000000000000000, 0.25000000000000000 },
49 { 0.93846980724081297, 0.0000000000000000, 0.50000000000000000 },
50 { 0.86424227516664853, 0.0000000000000000, 0.75000000000000000 },
51 { 0.76519768655796661, 0.0000000000000000, 1.0000000000000000 },
52 { 0.64590608527128535, 0.0000000000000000, 1.2500000000000000 },
53 { 0.51182767173591814, 0.0000000000000000, 1.5000000000000000 },
54 { 0.36903253018515075, 0.0000000000000000, 1.7500000000000000 },
55 { 0.22389077914123562, 0.0000000000000000, 2.0000000000000000 },
56 { 0.082749851288734022, 0.0000000000000000, 2.2500000000000000 },
57 { -0.048383776468197998, 0.0000000000000000, 2.5000000000000000 },
58 { -0.16414142780851368, 0.0000000000000000, 2.7500000000000000 },
59 { -0.26005195490193334, 0.0000000000000000, 3.0000000000000000 },
60 { -0.33275080217061132, 0.0000000000000000, 3.2500000000000000 },
61 { -0.38012773998726335, 0.0000000000000000, 3.5000000000000000 },
62 { -0.40140605493617426, 0.0000000000000000, 3.7500000000000000 },
63 { -0.39714980986384740, 0.0000000000000000, 4.0000000000000000 },
64 { -0.36919977029989554, 0.0000000000000000, 4.2500000000000000 },
65 { -0.32054250898512149, 0.0000000000000000, 4.5000000000000000 },
66 { -0.25512082749137405, 0.0000000000000000, 4.7500000000000000 },
67 { -0.17759677131433835, 0.0000000000000000, 5.0000000000000000 },
68 };
69 const double toler001 = 2.5000000000000020e-13;
70
71 // Test data for nu=0.33333333333333331.
72 // max(|f - f_GSL|): 7.7715611723760958e-16
73 // max(|f - f_GSL| / |f_GSL|): 1.2121143083098064e-15
74 const testcase_cyl_bessel_j<double>
75 data002[21] =
76 {
77 { 0.0000000000000000, 0.33333333333333331, 0.0000000000000000 },
78 { 0.55338359549647709, 0.33333333333333331, 0.25000000000000000 },
79 { 0.67283082949794537, 0.33333333333333331, 0.50000000000000000 },
80 { 0.72490863199379008, 0.33333333333333331, 0.75000000000000000 },
81 { 0.73087640216944760, 0.33333333333333331, 1.0000000000000000 },
82 { 0.69953374433894455, 0.33333333333333331, 1.2500000000000000 },
83 { 0.63713263706489176, 0.33333333333333331, 1.5000000000000000 },
84 { 0.54956352730788460, 0.33333333333333331, 1.7500000000000000 },
85 { 0.44293981814857586, 0.33333333333333331, 2.0000000000000000 },
86 { 0.32366988946292502, 0.33333333333333331, 2.2500000000000000 },
87 { 0.19832093341860796, 0.33333333333333331, 2.5000000000000000 },
88 { 0.073389637874297489, 0.33333333333333331, 2.7500000000000000 },
89 { -0.044963820940233351, 0.33333333333333331, 3.0000000000000000 },
90 { -0.15118395956666372, 0.33333333333333331, 3.2500000000000000 },
91 { -0.24056593952693625, 0.33333333333333331, 3.5000000000000000 },
92 { -0.30946094681921288, 0.33333333333333331, 3.7500000000000000 },
93 { -0.35542737345457609, 0.33333333333333331, 4.0000000000000000 },
94 { -0.37731852825457068, 0.33333333333333331, 4.2500000000000000 },
95 { -0.37530189159358079, 0.33333333333333331, 4.5000000000000000 },
96 { -0.35080916720916927, 0.33333333333333331, 4.7500000000000000 },
97 { -0.30642046380026405, 0.33333333333333331, 5.0000000000000000 },
98 };
99 const double toler002 = 2.5000000000000020e-13;
100
101 // Test data for nu=0.50000000000000000.
102 // max(|f - f_GSL|): 7.7715611723760958e-16
103 // max(|f - f_GSL| / |f_GSL|): 1.1959227189513475e-15
104 const testcase_cyl_bessel_j<double>
105 data003[21] =
106 {
107 { 0.0000000000000000, 0.50000000000000000, 0.0000000000000000 },
108 { 0.39479959874136972, 0.50000000000000000, 0.25000000000000000 },
109 { 0.54097378993452760, 0.50000000000000000, 0.50000000000000000 },
110 { 0.62800587637588623, 0.50000000000000000, 0.75000000000000000 },
111 { 0.67139670714180244, 0.50000000000000000, 1.0000000000000000 },
112 { 0.67724253810014312, 0.50000000000000000, 1.2500000000000000 },
113 { 0.64983807475374655, 0.50000000000000000, 1.5000000000000000 },
114 { 0.59348525447147382, 0.50000000000000000, 1.7500000000000000 },
115 { 0.51301613656182721, 0.50000000000000000, 2.0000000000000000 },
116 { 0.41387506064759982, 0.50000000000000000, 2.2500000000000000 },
117 { 0.30200490606236535, 0.50000000000000000, 2.5000000000000000 },
118 { 0.18363332138431521, 0.50000000000000000, 2.7500000000000000 },
119 { 0.065008182877375753, 0.50000000000000000, 3.0000000000000000 },
120 { -0.047885729975898544, 0.50000000000000000, 3.2500000000000000 },
121 { -0.14960456964952620, 0.50000000000000000, 3.5000000000000000 },
122 { -0.23549801845815513, 0.50000000000000000, 3.7500000000000000 },
123 { -0.30192051329163944, 0.50000000000000000, 4.0000000000000000 },
124 { -0.34638850218952444, 0.50000000000000000, 4.2500000000000000 },
125 { -0.36767487332724025, 0.50000000000000000, 4.5000000000000000 },
126 { -0.36583563802350400, 0.50000000000000000, 4.7500000000000000 },
127 { -0.34216798479816180, 0.50000000000000000, 5.0000000000000000 },
128 };
129 const double toler003 = 2.5000000000000020e-13;
130
131 // Test data for nu=0.66666666666666663.
132 // max(|f - f_GSL|): 7.7715611723760958e-16
133 // max(|f - f_GSL| / |f_GSL|): 1.4163878424300161e-15
134 const testcase_cyl_bessel_j<double>
135 data004[21] =
136 {
137 { 0.0000000000000000, 0.66666666666666663, 0.0000000000000000 },
138 { 0.27434438998865135, 0.66666666666666663, 0.25000000000000000 },
139 { 0.42331075068448321, 0.66666666666666663, 0.50000000000000000 },
140 { 0.52870551548162792, 0.66666666666666663, 0.75000000000000000 },
141 { 0.59794997367362801, 0.66666666666666663, 1.0000000000000000 },
142 { 0.63338726889075891, 0.66666666666666663, 1.2500000000000000 },
143 { 0.63673234502877385, 0.66666666666666663, 1.5000000000000000 },
144 { 0.61022230460131899, 0.66666666666666663, 1.7500000000000000 },
145 { 0.55696967691913712, 0.66666666666666663, 2.0000000000000000 },
146 { 0.48101276749106114, 0.66666666666666663, 2.2500000000000000 },
147 { 0.38721242477084306, 0.66666666666666663, 2.5000000000000000 },
148 { 0.28105724771080542, 0.66666666666666663, 2.7500000000000000 },
149 { 0.16841218049067044, 0.66666666666666663, 3.0000000000000000 },
150 { 0.055235893475364915, 0.66666666666666663, 3.2500000000000000 },
151 { -0.052711584404031925, 0.66666666666666663, 3.5000000000000000 },
152 { -0.15015178042293029, 0.66666666666666663, 3.7500000000000000 },
153 { -0.23254408502670390, 0.66666666666666663, 4.0000000000000000 },
154 { -0.29630067002972543, 0.66666666666666663, 4.2500000000000000 },
155 { -0.33894810189777724, 0.66666666666666663, 4.5000000000000000 },
156 { -0.35922706960321099, 0.66666666666666663, 4.7500000000000000 },
157 { -0.35712533549168868, 0.66666666666666663, 5.0000000000000000 },
158 };
159 const double toler004 = 2.5000000000000020e-13;
160
161 // Test data for nu=1.0000000000000000.
162 // max(|f - f_GSL|): 2.2204460492503131e-16
163 // max(|f - f_GSL| / |f_GSL|): 6.7783500059747526e-16
164 const testcase_cyl_bessel_j<double>
165 data005[21] =
166 {
167 { 0.0000000000000000, 1.0000000000000000, 0.0000000000000000 },
168 { 0.12402597732272694, 1.0000000000000000, 0.25000000000000000 },
169 { 0.24226845767487390, 1.0000000000000000, 0.50000000000000000 },
170 { 0.34924360217486222, 1.0000000000000000, 0.75000000000000000 },
171 { 0.44005058574493355, 1.0000000000000000, 1.0000000000000000 },
172 { 0.51062326031988059, 1.0000000000000000, 1.2500000000000000 },
173 { 0.55793650791009952, 1.0000000000000000, 1.5000000000000000 },
174 { 0.58015619763899240, 1.0000000000000000, 1.7500000000000000 },
175 { 0.57672480775687363, 1.0000000000000000, 2.0000000000000000 },
176 { 0.54837835664696011, 1.0000000000000000, 2.2500000000000000 },
177 { 0.49709410246427416, 1.0000000000000000, 2.5000000000000000 },
178 { 0.42597230295790256, 1.0000000000000000, 2.7500000000000000 },
179 { 0.33905895852593648, 1.0000000000000000, 3.0000000000000000 },
180 { 0.24111968801520400, 1.0000000000000000, 3.2500000000000000 },
181 { 0.13737752736232706, 1.0000000000000000, 3.5000000000000000 },
182 { 0.033229349129679724, 1.0000000000000000, 3.7500000000000000 },
183 { -0.066043328023549230, 1.0000000000000000, 4.0000000000000000 },
184 { -0.15555319297834286, 1.0000000000000000, 4.2500000000000000 },
185 { -0.23106043192337070, 1.0000000000000000, 4.5000000000000000 },
186 { -0.28918679864711044, 1.0000000000000000, 4.7500000000000000 },
187 { -0.32757913759146529, 1.0000000000000000, 5.0000000000000000 },
188 };
189 const double toler005 = 2.5000000000000020e-13;
190
191 // Test data for nu=2.0000000000000000.
192 // max(|f - f_GSL|): 5.5511151231257827e-17
193 // max(|f - f_GSL| / |f_GSL|): 2.4155555971238584e-16
194 const testcase_cyl_bessel_j<double>
195 data006[21] =
196 {
197 { 0.0000000000000000, 2.0000000000000000, 0.0000000000000000 },
198 { 0.0077718892859626760, 2.0000000000000000, 0.25000000000000000 },
199 { 0.030604023458682638, 2.0000000000000000, 0.50000000000000000 },
200 { 0.067073997299650551, 2.0000000000000000, 0.75000000000000000 },
201 { 0.11490348493190047, 2.0000000000000000, 1.0000000000000000 },
202 { 0.17109113124052350, 2.0000000000000000, 1.2500000000000000 },
203 { 0.23208767214421472, 2.0000000000000000, 1.5000000000000000 },
204 { 0.29400312425941216, 2.0000000000000000, 1.7500000000000000 },
205 { 0.35283402861563773, 2.0000000000000000, 2.0000000000000000 },
206 { 0.40469757684189717, 2.0000000000000000, 2.2500000000000000 },
207 { 0.44605905843961718, 2.0000000000000000, 2.5000000000000000 },
208 { 0.47393946632335160, 2.0000000000000000, 2.7500000000000000 },
209 { 0.48609126058589119, 2.0000000000000000, 3.0000000000000000 },
210 { 0.48113214864150627, 2.0000000000000000, 3.2500000000000000 },
211 { 0.45862918419430765, 2.0000000000000000, 3.5000000000000000 },
212 { 0.41912837447200352, 2.0000000000000000, 3.7500000000000000 },
213 { 0.36412814585207293, 2.0000000000000000, 4.0000000000000000 },
214 { 0.29599826772185189, 2.0000000000000000, 4.2500000000000000 },
215 { 0.21784898368584549, 2.0000000000000000, 4.5000000000000000 },
216 { 0.13335796490311685, 2.0000000000000000, 4.7500000000000000 },
217 { 0.046565116277751971, 2.0000000000000000, 5.0000000000000000 },
218 };
219 const double toler006 = 2.5000000000000020e-13;
220
221 // Test data for nu=5.0000000000000000.
222 // max(|f - f_GSL|): 1.3877787807814457e-16
223 // max(|f - f_GSL| / |f_GSL|): 1.4609680807504906e-15
224 const testcase_cyl_bessel_j<double>
225 data007[21] =
226 {
227 { 0.0000000000000000, 5.0000000000000000, 0.0000000000000000 },
228 { 2.5365161587472413e-07, 5.0000000000000000, 0.25000000000000000 },
229 { 8.0536272413574753e-06, 5.0000000000000000, 0.50000000000000000 },
230 { 6.0364166510576438e-05, 5.0000000000000000, 0.75000000000000000 },
231 { 0.00024975773021123450, 5.0000000000000000, 1.0000000000000000 },
232 { 0.00074440885254749821, 5.0000000000000000, 1.2500000000000000 },
233 { 0.0017994217673606111, 5.0000000000000000, 1.5000000000000000 },
234 { 0.0037577257273157133, 5.0000000000000000, 1.7500000000000000 },
235 { 0.0070396297558716842, 5.0000000000000000, 2.0000000000000000 },
236 { 0.012121078633445751, 5.0000000000000000, 2.2500000000000000 },
237 { 0.019501625134503223, 5.0000000000000000, 2.5000000000000000 },
238 { 0.029664058320006174, 5.0000000000000000, 2.7500000000000000 },
239 { 0.043028434877047578, 5.0000000000000000, 3.0000000000000000 },
240 { 0.059903888098560426, 5.0000000000000000, 3.2500000000000000 },
241 { 0.080441986647991792, 5.0000000000000000, 3.5000000000000000 },
242 { 0.10459554742314070, 5.0000000000000000, 3.7500000000000000 },
243 { 0.13208665604709827, 5.0000000000000000, 4.0000000000000000 },
244 { 0.16238721643623680, 5.0000000000000000, 4.2500000000000000 },
245 { 0.19471465863871368, 5.0000000000000000, 4.5000000000000000 },
246 { 0.22804452118769436, 5.0000000000000000, 4.7500000000000000 },
247 { 0.26114054612017007, 5.0000000000000000, 5.0000000000000000 },
248 };
249 const double toler007 = 2.5000000000000020e-13;
250
251 // Test data for nu=10.000000000000000.
252 // max(|f - f_GSL|): 3.2526065174565133e-18
253 // max(|f - f_GSL| / |f_GSL|): 3.9336732209858561e-15
254 const testcase_cyl_bessel_j<double>
255 data008[21] =
256 {
257 { 0.0000000000000000, 10.000000000000000, 0.0000000000000000 },
258 { 2.5628321598050096e-16, 10.000000000000000, 0.25000000000000000 },
259 { 2.6131773608228023e-13, 10.000000000000000, 0.50000000000000000 },
260 { 1.4962171311759677e-11, 10.000000000000000, 0.75000000000000000 },
261 { 2.6306151236874524e-10, 10.000000000000000, 1.0000000000000000 },
262 { 2.4187548221114514e-09, 10.000000000000000, 1.2500000000000000 },
263 { 1.4743269078039996e-08, 10.000000000000000, 1.5000000000000000 },
264 { 6.7608502849897560e-08, 10.000000000000000, 1.7500000000000000 },
265 { 2.5153862827167358e-07, 10.000000000000000, 2.0000000000000000 },
266 { 7.9717051583730038e-07, 10.000000000000000, 2.2500000000000000 },
267 { 2.2247284173983839e-06, 10.000000000000000, 2.5000000000000000 },
268 { 5.5985475639210430e-06, 10.000000000000000, 2.7500000000000000 },
269 { 1.2928351645715880e-05, 10.000000000000000, 3.0000000000000000 },
270 { 2.7761691354244538e-05, 10.000000000000000, 3.2500000000000000 },
271 { 5.6009495875078844e-05, 10.000000000000000, 3.5000000000000000 },
272 { 0.00010703761729231951, 10.000000000000000, 3.7500000000000000 },
273 { 0.00019504055466003446, 10.000000000000000, 4.0000000000000000 },
274 { 0.00034068888474064193, 10.000000000000000, 4.2500000000000000 },
275 { 0.00057300977667164505, 10.000000000000000, 4.5000000000000000 },
276 { 0.00093142172588886810, 10.000000000000000, 4.7500000000000000 },
277 { 0.0014678026473104744, 10.000000000000000, 5.0000000000000000 },
278 };
279 const double toler008 = 2.5000000000000020e-13;
280
281 // Test data for nu=20.000000000000000.
282 // max(|f - f_GSL|): 1.9387045606711586e-26
283 // max(|f - f_GSL| / |f_GSL|): 2.1275572270326799e-15
284 const testcase_cyl_bessel_j<double>
285 data009[21] =
286 {
287 { 0.0000000000000000, 20.000000000000000, 0.0000000000000000 },
288 { 3.5624805510586969e-37, 20.000000000000000, 0.25000000000000000 },
289 { 3.7272019617047132e-31, 20.000000000000000, 0.50000000000000000 },
290 { 1.2347870693633488e-27, 20.000000000000000, 0.75000000000000000 },
291 { 3.8735030085246562e-25, 20.000000000000000, 1.0000000000000000 },
292 { 3.3372897667043766e-23, 20.000000000000000, 1.2500000000000000 },
293 { 1.2689972189332558e-21, 20.000000000000000, 1.5000000000000000 },
294 { 2.7427715944032989e-20, 20.000000000000000, 1.7500000000000000 },
295 { 3.9189728050907524e-19, 20.000000000000000, 2.0000000000000000 },
296 { 4.0805232551365158e-18, 20.000000000000000, 2.2500000000000000 },
297 { 3.3090793836587786e-17, 20.000000000000000, 2.5000000000000000 },
298 { 2.1915404680645990e-16, 20.000000000000000, 2.7500000000000000 },
299 { 1.2275946737992981e-15, 20.000000000000000, 3.0000000000000000 },
300 { 5.9727663938305382e-15, 20.000000000000000, 3.2500000000000000 },
301 { 2.5768553102807590e-14, 20.000000000000000, 3.5000000000000000 },
302 { 1.0021112208287217e-13, 20.000000000000000, 3.7500000000000000 },
303 { 3.5595116285938516e-13, 20.000000000000000, 4.0000000000000000 },
304 { 1.1673622958555074e-12, 20.000000000000000, 4.2500000000000000 },
305 { 3.5665470983611762e-12, 20.000000000000000, 4.5000000000000000 },
306 { 1.0227564044880958e-11, 20.000000000000000, 4.7500000000000000 },
307 { 2.7703300521289426e-11, 20.000000000000000, 5.0000000000000000 },
308 };
309 const double toler009 = 2.5000000000000020e-13;
310 // cyl_bessel_j
311
312 // Test data for nu=0.0000000000000000.
313 // max(|f - f_GSL|): 7.6709472107694410e-15
314 // max(|f - f_GSL| / |f_GSL|): 4.1048891312746575e-13
315 const testcase_cyl_bessel_j<double>
316 data010[21] =
317 {
318 { 1.0000000000000000, 0.0000000000000000, 0.0000000000000000 },
319 { -0.17759677131433835, 0.0000000000000000, 5.0000000000000000 },
320 { -0.24593576445134835, 0.0000000000000000, 10.000000000000000 },
321 { -0.014224472826780771, 0.0000000000000000, 15.000000000000000 },
322 { 0.16702466434058319, 0.0000000000000000, 20.000000000000000 },
323 { 0.096266783275958154, 0.0000000000000000, 25.000000000000000 },
324 { -0.086367983581040142, 0.0000000000000000, 30.000000000000000 },
325 { -0.12684568275631256, 0.0000000000000000, 35.000000000000000 },
326 { 0.0073668905842374085, 0.0000000000000000, 40.000000000000000 },
327 { 0.11581867067325631, 0.0000000000000000, 45.000000000000000 },
328 { 0.055812327669251746, 0.0000000000000000, 50.000000000000000 },
329 { -0.074548302648236808, 0.0000000000000000, 55.000000000000000 },
330 { -0.091471804089061859, 0.0000000000000000, 60.000000000000000 },
331 { 0.018687343227677979, 0.0000000000000000, 65.000000000000000 },
332 { 0.094908726483013545, 0.0000000000000000, 70.000000000000000 },
333 { 0.034643913805097008, 0.0000000000000000, 75.000000000000000 },
334 { -0.069742165512210033, 0.0000000000000000, 80.000000000000000 },
335 { -0.070940394796273273, 0.0000000000000000, 85.000000000000000 },
336 { 0.026630016699969526, 0.0000000000000000, 90.000000000000000 },
337 { 0.081811967783384135, 0.0000000000000000, 95.000000000000000 },
338 { 0.019985850304223170, 0.0000000000000000, 100.00000000000000 },
339 };
340 const double toler010 = 2.5000000000000014e-11;
341
342 // Test data for nu=0.33333333333333331.
343 // max(|f - f_GSL|): 7.9311557321659620e-15
344 // max(|f - f_GSL| / |f_GSL|): 4.2444155318123211e-12
345 const testcase_cyl_bessel_j<double>
346 data011[21] =
347 {
348 { 0.0000000000000000, 0.33333333333333331, 0.0000000000000000 },
349 { -0.30642046380026405, 0.33333333333333331, 5.0000000000000000 },
350 { -0.18614516704869571, 0.33333333333333331, 10.000000000000000 },
351 { 0.089740004221152650, 0.33333333333333331, 15.000000000000000 },
352 { 0.17606058001293901, 0.33333333333333331, 20.000000000000000 },
353 { 0.020097162141383233, 0.33333333333333331, 25.000000000000000 },
354 { -0.13334053387426159, 0.33333333333333331, 30.000000000000000 },
355 { -0.087118009397765497, 0.33333333333333331, 35.000000000000000 },
356 { 0.069202942818858179, 0.33333333333333331, 40.000000000000000 },
357 { 0.11387616964518317, 0.33333333333333331, 45.000000000000000 },
358 { -0.00057226680771808045, 0.33333333333333331, 50.000000000000000 },
359 { -0.10331600929280822, 0.33333333333333331, 55.000000000000000 },
360 { -0.055618147270528003, 0.33333333333333331, 60.000000000000000 },
361 { 0.064711954014113948, 0.33333333333333331, 65.000000000000000 },
362 { 0.086879926462481605, 0.33333333333333331, 70.000000000000000 },
363 { -0.012614484229891068, 0.33333333333333331, 75.000000000000000 },
364 { -0.088199784400034537, 0.33333333333333331, 80.000000000000000 },
365 { -0.036703611076564523, 0.33333333333333331, 85.000000000000000 },
366 { 0.062916286828779547, 0.33333333333333331, 90.000000000000000 },
367 { 0.069465244416806030, 0.33333333333333331, 95.000000000000000 },
368 { -0.021271244853702364, 0.33333333333333331, 100.00000000000000 },
369 };
370 const double toler011 = 2.5000000000000017e-10;
371
372 // Test data for nu=0.50000000000000000.
373 // max(|f - f_GSL|): 7.4246164771807344e-15
374 // max(|f - f_GSL| / |f_GSL|): 3.6725252809051799e-13
375 const testcase_cyl_bessel_j<double>
376 data012[21] =
377 {
378 { 0.0000000000000000, 0.50000000000000000, 0.0000000000000000 },
379 { -0.34216798479816180, 0.50000000000000000, 5.0000000000000000 },
380 { -0.13726373575505049, 0.50000000000000000, 10.000000000000000 },
381 { 0.13396768882243937, 0.50000000000000000, 15.000000000000000 },
382 { 0.16288076385502984, 0.50000000000000000, 20.000000000000000 },
383 { -0.021120283599650493, 0.50000000000000000, 25.000000000000000 },
384 { -0.14392965337039987, 0.50000000000000000, 30.000000000000000 },
385 { -0.057747757589458777, 0.50000000000000000, 35.000000000000000 },
386 { 0.094000962389533649, 0.50000000000000000, 40.000000000000000 },
387 { 0.10120783324271411, 0.50000000000000000, 45.000000000000000 },
388 { -0.029605831888924641, 0.50000000000000000, 50.000000000000000 },
389 { -0.10756039213265806, 0.50000000000000000, 55.000000000000000 },
390 { -0.031397461182520438, 0.50000000000000000, 60.000000000000000 },
391 { 0.081827430775628554, 0.50000000000000000, 65.000000000000000 },
392 { 0.073802429539054554, 0.50000000000000000, 70.000000000000000 },
393 { -0.035727009681702615, 0.50000000000000000, 75.000000000000000 },
394 { -0.088661035811765460, 0.50000000000000000, 80.000000000000000 },
395 { -0.015238065106312516, 0.50000000000000000, 85.000000000000000 },
396 { 0.075189068550269425, 0.50000000000000000, 90.000000000000000 },
397 { 0.055932643481494133, 0.50000000000000000, 95.000000000000000 },
398 { -0.040402132716252127, 0.50000000000000000, 100.00000000000000 },
399 };
400 const double toler012 = 2.5000000000000014e-11;
401
402 // Test data for nu=0.66666666666666663.
403 // max(|f - f_GSL|): 6.3629657098829284e-15
404 // max(|f - f_GSL| / |f_GSL|): 1.2254869540384518e-12
405 const testcase_cyl_bessel_j<double>
406 data013[21] =
407 {
408 { 0.0000000000000000, 0.66666666666666663, 0.0000000000000000 },
409 { -0.35712533549168868, 0.66666666666666663, 5.0000000000000000 },
410 { -0.080149603304315808, 0.66666666666666663, 10.000000000000000 },
411 { 0.16918875175798079, 0.66666666666666663, 15.000000000000000 },
412 { 0.13904826122116531, 0.66666666666666663, 20.000000000000000 },
413 { -0.060770629698497600, 0.66666666666666663, 25.000000000000000 },
414 { -0.14489851974205062, 0.66666666666666663, 30.000000000000000 },
415 { -0.024604880159644394, 0.66666666666666663, 35.000000000000000 },
416 { 0.11243936464912010, 0.66666666666666663, 40.000000000000000 },
417 { 0.081776275512525309, 0.66666666666666663, 45.000000000000000 },
418 { -0.056589908749367777, 0.66666666666666663, 50.000000000000000 },
419 { -0.10455814523765931, 0.66666666666666663, 55.000000000000000 },
420 { -0.0051030148548608456, 0.66666666666666663, 60.000000000000000 },
421 { 0.093398227061639236, 0.66666666666666663, 65.000000000000000 },
422 { 0.055763883611864913, 0.66666666666666663, 70.000000000000000 },
423 { -0.056395322915757364, 0.66666666666666663, 75.000000000000000 },
424 { -0.083131347805783087, 0.66666666666666663, 80.000000000000000 },
425 { 0.0072315397874096648, 0.66666666666666663, 85.000000000000000 },
426 { 0.082362798520905250, 0.66666666666666663, 90.000000000000000 },
427 { 0.038630504403446168, 0.66666666666666663, 95.000000000000000 },
428 { -0.056778819380529734, 0.66666666666666663, 100.00000000000000 },
429 };
430 const double toler013 = 1.0000000000000006e-10;
431
432 // Test data for nu=1.0000000000000000.
433 // max(|f - f_GSL|): 7.1435912740724916e-15
434 // max(|f - f_GSL| / |f_GSL|): 1.7857949645087573e-12
435 const testcase_cyl_bessel_j<double>
436 data014[21] =
437 {
438 { 0.0000000000000000, 1.0000000000000000, 0.0000000000000000 },
439 { -0.32757913759146529, 1.0000000000000000, 5.0000000000000000 },
440 { 0.043472746168861459, 1.0000000000000000, 10.000000000000000 },
441 { 0.20510403861352280, 1.0000000000000000, 15.000000000000000 },
442 { 0.066833124175850078, 1.0000000000000000, 20.000000000000000 },
443 { -0.12535024958028990, 1.0000000000000000, 25.000000000000000 },
444 { -0.11875106261662294, 1.0000000000000000, 30.000000000000000 },
445 { 0.043990942179625646, 1.0000000000000000, 35.000000000000000 },
446 { 0.12603831803758500, 1.0000000000000000, 40.000000000000000 },
447 { 0.028348854376424561, 1.0000000000000000, 45.000000000000000 },
448 { -0.097511828125175129, 1.0000000000000000, 50.000000000000000 },
449 { -0.078250038308684711, 1.0000000000000000, 55.000000000000000 },
450 { 0.046598383758166370, 1.0000000000000000, 60.000000000000000 },
451 { 0.097330172226126929, 1.0000000000000000, 65.000000000000000 },
452 { 0.0099877887848385128, 1.0000000000000000, 70.000000000000000 },
453 { -0.085139995044829081, 1.0000000000000000, 75.000000000000000 },
454 { -0.056057296675712555, 1.0000000000000000, 80.000000000000000 },
455 { 0.049151460334891130, 1.0000000000000000, 85.000000000000000 },
456 { 0.079925646708868092, 1.0000000000000000, 90.000000000000000 },
457 { -0.0023925612997269283, 1.0000000000000000, 95.000000000000000 },
458 { -0.077145352014112129, 1.0000000000000000, 100.00000000000000 },
459 };
460 const double toler014 = 1.0000000000000006e-10;
461
462 // Test data for nu=2.0000000000000000.
463 // max(|f - f_GSL|): 7.6050277186823223e-15
464 // max(|f - f_GSL| / |f_GSL|): 2.0010877493528614e-12
465 const testcase_cyl_bessel_j<double>
466 data015[21] =
467 {
468 { 0.0000000000000000, 2.0000000000000000, 0.0000000000000000 },
469 { 0.046565116277751971, 2.0000000000000000, 5.0000000000000000 },
470 { 0.25463031368512068, 2.0000000000000000, 10.000000000000000 },
471 { 0.041571677975250486, 2.0000000000000000, 15.000000000000000 },
472 { -0.16034135192299820, 2.0000000000000000, 20.000000000000000 },
473 { -0.10629480324238134, 2.0000000000000000, 25.000000000000000 },
474 { 0.078451246073265299, 2.0000000000000000, 30.000000000000000 },
475 { 0.12935945088086259, 2.0000000000000000, 35.000000000000000 },
476 { -0.0010649746823579794, 2.0000000000000000, 40.000000000000000 },
477 { -0.11455872158985966, 2.0000000000000000, 45.000000000000000 },
478 { -0.059712800794258863, 2.0000000000000000, 50.000000000000000 },
479 { 0.071702846709739240, 2.0000000000000000, 55.000000000000000 },
480 { 0.093025083547667420, 2.0000000000000000, 60.000000000000000 },
481 { -0.015692568697643128, 2.0000000000000000, 65.000000000000000 },
482 { -0.094623361089161029, 2.0000000000000000, 70.000000000000000 },
483 { -0.036914313672959179, 2.0000000000000000, 75.000000000000000 },
484 { 0.068340733095317172, 2.0000000000000000, 80.000000000000000 },
485 { 0.072096899745329540, 2.0000000000000000, 85.000000000000000 },
486 { -0.024853891217550248, 2.0000000000000000, 90.000000000000000 },
487 { -0.081862337494957332, 2.0000000000000000, 95.000000000000000 },
488 { -0.021528757344505364, 2.0000000000000000, 100.00000000000000 },
489 };
490 const double toler015 = 2.5000000000000017e-10;
491
492 // Test data for nu=5.0000000000000000.
493 // max(|f - f_GSL|): 6.8521577301083880e-15
494 // max(|f - f_GSL| / |f_GSL|): 5.6813560677959848e-13
495 const testcase_cyl_bessel_j<double>
496 data016[21] =
497 {
498 { 0.0000000000000000, 5.0000000000000000, 0.0000000000000000 },
499 { 0.26114054612017007, 5.0000000000000000, 5.0000000000000000 },
500 { -0.23406152818679371, 5.0000000000000000, 10.000000000000000 },
501 { 0.13045613456502966, 5.0000000000000000, 15.000000000000000 },
502 { 0.15116976798239498, 5.0000000000000000, 20.000000000000000 },
503 { -0.066007995398422933, 5.0000000000000000, 25.000000000000000 },
504 { -0.14324029551207709, 5.0000000000000000, 30.000000000000000 },
505 { -0.0015053072953907251, 5.0000000000000000, 35.000000000000000 },
506 { 0.12257346597711777, 5.0000000000000000, 40.000000000000000 },
507 { 0.057984499200954109, 5.0000000000000000, 45.000000000000000 },
508 { -0.081400247696569616, 5.0000000000000000, 50.000000000000000 },
509 { -0.092569895786432765, 5.0000000000000000, 55.000000000000000 },
510 { 0.027454744228344204, 5.0000000000000000, 60.000000000000000 },
511 { 0.099110527701539025, 5.0000000000000000, 65.000000000000000 },
512 { 0.026058129823895364, 5.0000000000000000, 70.000000000000000 },
513 { -0.078523977013751398, 5.0000000000000000, 75.000000000000000 },
514 { -0.065862349140031584, 5.0000000000000000, 80.000000000000000 },
515 { 0.038669072284680979, 5.0000000000000000, 85.000000000000000 },
516 { 0.082759319528415157, 5.0000000000000000, 90.000000000000000 },
517 { 0.0079423372702472871, 5.0000000000000000, 95.000000000000000 },
518 { -0.074195736964513898, 5.0000000000000000, 100.00000000000000 },
519 };
520 const double toler016 = 5.0000000000000028e-11;
521
522 // Test data for nu=10.000000000000000.
523 // max(|f - f_GSL|): 7.2303274478713320e-15
524 // max(|f - f_GSL| / |f_GSL|): 3.6974790630140835e-13
525 const testcase_cyl_bessel_j<double>
526 data017[21] =
527 {
528 { 0.0000000000000000, 10.000000000000000, 0.0000000000000000 },
529 { 0.0014678026473104744, 10.000000000000000, 5.0000000000000000 },
530 { 0.20748610663335865, 10.000000000000000, 10.000000000000000 },
531 { -0.090071811047659087, 10.000000000000000, 15.000000000000000 },
532 { 0.18648255802394512, 10.000000000000000, 20.000000000000000 },
533 { -0.075179843948523312, 10.000000000000000, 25.000000000000000 },
534 { -0.12987689399858882, 10.000000000000000, 30.000000000000000 },
535 { 0.063546391343962866, 10.000000000000000, 35.000000000000000 },
536 { 0.11938336278226094, 10.000000000000000, 40.000000000000000 },
537 { -0.026971402475010831, 10.000000000000000, 45.000000000000000 },
538 { -0.11384784914946940, 10.000000000000000, 50.000000000000000 },
539 { -0.015773790303746080, 10.000000000000000, 55.000000000000000 },
540 { 0.097177143328071064, 10.000000000000000, 60.000000000000000 },
541 { 0.054617389951112129, 10.000000000000000, 65.000000000000000 },
542 { -0.065870338561952013, 10.000000000000000, 70.000000000000000 },
543 { -0.080417867891894437, 10.000000000000000, 75.000000000000000 },
544 { 0.024043850978184747, 10.000000000000000, 80.000000000000000 },
545 { 0.086824832700067869, 10.000000000000000, 85.000000000000000 },
546 { 0.019554748856312299, 10.000000000000000, 90.000000000000000 },
547 { -0.072341598669443757, 10.000000000000000, 95.000000000000000 },
548 { -0.054732176935472096, 10.000000000000000, 100.00000000000000 },
549 };
550 const double toler017 = 2.5000000000000014e-11;
551
552 // Test data for nu=20.000000000000000.
553 // max(|f - f_GSL|): 7.7177847446208148e-15
554 // max(|f - f_GSL| / |f_GSL|): 1.1191513260854523e-12
555 const testcase_cyl_bessel_j<double>
556 data018[21] =
557 {
558 { 0.0000000000000000, 20.000000000000000, 0.0000000000000000 },
559 { 2.7703300521289426e-11, 20.000000000000000, 5.0000000000000000 },
560 { 1.1513369247813403e-05, 20.000000000000000, 10.000000000000000 },
561 { 0.0073602340792234934, 20.000000000000000, 15.000000000000000 },
562 { 0.16474777377532665, 20.000000000000000, 20.000000000000000 },
563 { 0.051994049228303307, 20.000000000000000, 25.000000000000000 },
564 { 0.0048310199934040923, 20.000000000000000, 30.000000000000000 },
565 { -0.10927417397178038, 20.000000000000000, 35.000000000000000 },
566 { 0.12779393355084889, 20.000000000000000, 40.000000000000000 },
567 { 0.0047633437900313621, 20.000000000000000, 45.000000000000000 },
568 { -0.11670435275957974, 20.000000000000000, 50.000000000000000 },
569 { 0.025389204574566639, 20.000000000000000, 55.000000000000000 },
570 { 0.10266020557876326, 20.000000000000000, 60.000000000000000 },
571 { -0.023138582263434154, 20.000000000000000, 65.000000000000000 },
572 { -0.096058573489952365, 20.000000000000000, 70.000000000000000 },
573 { 0.0068961047221522270, 20.000000000000000, 75.000000000000000 },
574 { 0.090565405489918357, 20.000000000000000, 80.000000000000000 },
575 { 0.015985497599497172, 20.000000000000000, 85.000000000000000 },
576 { -0.080345344044422534, 20.000000000000000, 90.000000000000000 },
577 { -0.040253075701614051, 20.000000000000000, 95.000000000000000 },
578 { 0.062217458498338672, 20.000000000000000, 100.00000000000000 },
579 };
580 const double toler018 = 1.0000000000000006e-10;
581
582 // Test data for nu=50.000000000000000.
583 // max(|f - f_GSL|): 6.6543992538470320e-15
584 // max(|f - f_GSL| / |f_GSL|): 1.6466369526724007e-13
585 const testcase_cyl_bessel_j<double>
586 data019[21] =
587 {
588 { 0.0000000000000000, 50.000000000000000, 0.0000000000000000 },
589 { 2.2942476159525415e-45, 50.000000000000000, 5.0000000000000000 },
590 { 1.7845136078715964e-30, 50.000000000000000, 10.000000000000000 },
591 { 6.1060519495338733e-22, 50.000000000000000, 15.000000000000000 },
592 { 4.4510392847006872e-16, 50.000000000000000, 20.000000000000000 },
593 { 9.7561594280229808e-12, 50.000000000000000, 25.000000000000000 },
594 { 2.0581656631564172e-08, 50.000000000000000, 30.000000000000000 },
595 { 7.6069951699272960e-06, 50.000000000000000, 35.000000000000000 },
596 { 0.00068185243531768309, 50.000000000000000, 40.000000000000000 },
597 { 0.017284343240791214, 50.000000000000000, 45.000000000000000 },
598 { 0.12140902189761507, 50.000000000000000, 50.000000000000000 },
599 { 0.13594720957176012, 50.000000000000000, 55.000000000000000 },
600 { -0.13798273148535209, 50.000000000000000, 60.000000000000000 },
601 { 0.12116217746619409, 50.000000000000000, 65.000000000000000 },
602 { -0.11394866738787145, 50.000000000000000, 70.000000000000000 },
603 { 0.094076799581573348, 50.000000000000000, 75.000000000000000 },
604 { -0.039457764590251347, 50.000000000000000, 80.000000000000000 },
605 { -0.040412060734136383, 50.000000000000000, 85.000000000000000 },
606 { 0.090802099838032266, 50.000000000000000, 90.000000000000000 },
607 { -0.055979156267280165, 50.000000000000000, 95.000000000000000 },
608 { -0.038698339728525440, 50.000000000000000, 100.00000000000000 },
609 };
610 const double toler019 = 1.0000000000000006e-11;
611
612 // Test data for nu=100.00000000000000.
613 // max(|f - f_GSL|): 4.8138576458356397e-17
614 // max(|f - f_GSL| / |f_GSL|): 1.0835289187603112e-13
615 const testcase_cyl_bessel_j<double>
616 data020[21] =
617 {
618 { 0.0000000000000000, 100.00000000000000, 0.0000000000000000 },
619 { 6.2677893955418763e-119, 100.00000000000000, 5.0000000000000000 },
620 { 6.5973160641553816e-89, 100.00000000000000, 10.000000000000000 },
621 { 1.9660095611249536e-71, 100.00000000000000, 15.000000000000000 },
622 { 3.9617550943362524e-59, 100.00000000000000, 20.000000000000000 },
623 { 1.1064482655301687e-49, 100.00000000000000, 25.000000000000000 },
624 { 4.5788015281752354e-42, 100.00000000000000, 30.000000000000000 },
625 { 9.9210206714732606e-36, 100.00000000000000, 35.000000000000000 },
626 { 2.3866062996027414e-30, 100.00000000000000, 40.000000000000000 },
627 { 1.0329791804565538e-25, 100.00000000000000, 45.000000000000000 },
628 { 1.1159273690838340e-21, 100.00000000000000, 50.000000000000000 },
629 { 3.7899753451900682e-18, 100.00000000000000, 55.000000000000000 },
630 { 4.7832744078781205e-15, 100.00000000000000, 60.000000000000000 },
631 { 2.5375564579490517e-12, 100.00000000000000, 65.000000000000000 },
632 { 6.1982452141641260e-10, 100.00000000000000, 70.000000000000000 },
633 { 7.4479005905904457e-08, 100.00000000000000, 75.000000000000000 },
634 { 4.6065530648234948e-06, 100.00000000000000, 80.000000000000000 },
635 { 0.00015043869999501765, 100.00000000000000, 85.000000000000000 },
636 { 0.0026021305819963472, 100.00000000000000, 90.000000000000000 },
637 { 0.023150768009428030, 100.00000000000000, 95.000000000000000 },
638 { 0.096366673295861571, 100.00000000000000, 100.00000000000000 },
639 };
640 const double toler020 = 1.0000000000000006e-11;
641
642 template<typename Tp, unsigned int Num>
643 void
644 test(const testcase_cyl_bessel_j<Tp> (&data)[Num], Tp toler)
645 {
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)
651 {
652 const Tp f = std::cyl_bessel_j(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)
659 {
660 const Tp frac = diff / f0;
661 if (std::abs(frac) > max_abs_frac)
662 max_abs_frac = std::abs(frac);
663 }
664 }
665 VERIFY(max_abs_frac < toler);
666 }
667
668 int
669 main()
670 {
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;
692 }