Debian Codegraph @

external/gsl/gsl_specfunc__bessel_J1.c

raw symbols SCIP
1 /* specfunc/bessel_J1.c
2 *
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20 /* Author: G. Jungman */
21
22 #include "gsl__config.h"cxx . . $ `<file>/external/gsl/gsl__config.h`/
23 #include "gsl_math.h"cxx . . $ `<file>/external/gsl/gsl_math.h`/
24 #include "gsl_errno.h"cxx . . $ `<file>/external/gsl/gsl_errno.h`/
25 #include "gsl_sf_trig.h"cxx . . $ `<file>/external/gsl/gsl_sf_trig.h`/
26 #include "gsl_sf_bessel.h"cxx . . $ `<file>/external/gsl/gsl_sf_bessel.h`/
27
28 #include "gsl_specfunc__error.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__error.h`/
29
30 #include "gsl_specfunc__bessel.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__bessel.h`/
31 #include "gsl_specfunc__bessel_amp_phase.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__bessel_amp_phase.h`/
32 #include "gsl_specfunc__cheb_eval.c"cxx . . $ `<file>/external/gsl/gsl_specfunc__cheb_eval.c`/
33
34 #define ROOT_EIGHTcxx . . $ `external/gsl/gsl_specfunc__bessel_J1.c:34:9`! (2.0*M_SQRT2cxx . . $ `<external>/11263917310783833665/math.h:1127:10`!)
35
36 /*-*-*-*-*-*-*-*-*-*-*-* Private Section *-*-*-*-*-*-*-*-*-*-*-*/
37
38
39 /* based on SLATEC besj1, 1983 version, w. fullerton */
40
41 /* chebyshev expansions
42
43 series for bj1 on the interval 0. to 1.60000d+01
44 with weighted error 4.48e-17
45 log weighted error 16.35
46 significant figures required 15.77
47 decimal places required 16.89
48
49 */
50 static double bj1_datacxx . . $ bj1_data.[12] = {
51 -0.11726141513332787,
52 -0.25361521830790640,
53 0.050127080984469569,
54 -0.004631514809625081,
55 0.000247996229415914,
56 -0.000008678948686278,
57 0.000000214293917143,
58 -0.000000003936093079,
59 0.000000000055911823,
60 -0.000000000000632761,
61 0.000000000000005840,
62 -0.000000000000000044,
63 };
64 static cheb_seriescxx . . $ cheb_series# bj1_cscxx . . $ bj1_cs. = {
65 bj1_datacxx . . $ bj1_data.,
66 11,
67 -1, 1,
68 8
69 };
70
71
72 /*-*-*-*-*-*-*-*-*-*-*-* Functions with Error Codes *-*-*-*-*-*-*-*-*-*-*-*/
73
74 int gsl_sf_bessel_J1_ecxx . . $ gsl_sf_bessel_J1_e(feafd9287608bc44).(const double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result)
75 {
76 double y = fabs(x);
77
78 /* CHECK_POINTER(result) */
79
80 if(y == 0.0) {
81 result->valcxx . . $ gsl_sf_result_struct#val. = 0.0;
82 result->errcxx . . $ gsl_sf_result_struct#err. = 0.0;
83 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
84 }
85 else if(y < 2.0*GSL_DBL_MINcxx . . $ `external/gsl/gsl_machine.h:25:9`!) {
86 UNDERFLOW_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:3:9`!(result);
87 }
88 else if(y < ROOT_EIGHTcxx . . $ `external/gsl/gsl_specfunc__bessel_J1.c:34:9`! * GSL_SQRT_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:18:9`!) {
89 result->valcxx . . $ gsl_sf_result_struct#val. = 0.5*x;
90 result->errcxx . . $ gsl_sf_result_struct#err. = 0.0;
91 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
92 }
93 else if(y < 4.0) {
94 gsl_sf_resultcxx . . $ gsl_sf_result# c;
95 cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&bj1_cscxx . . $ bj1_cs., 0.125*y*y-1.0, &c);
96 result->valcxx . . $ gsl_sf_result_struct#val. = x * (0.25 + c.valcxx . . $ gsl_sf_result_struct#val.);
97 result->errcxx . . $ gsl_sf_result_struct#err. = fabs(x * c.errcxx . . $ gsl_sf_result_struct#err.);
98 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
99 }
100 else {
101 /* Because the leading term in the phase is y,
102 * which we assume is exactly known, the error
103 * in the cos() evaluation is bounded.
104 */
105 const double z = 32.0/(y*y) - 1.0;
106 gsl_sf_resultcxx . . $ gsl_sf_result# ca;
107 gsl_sf_resultcxx . . $ gsl_sf_result# ct;
108 gsl_sf_resultcxx . . $ gsl_sf_result# sp;
109 const int stat_ca = cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&_gsl_sf_bessel_amp_phase_bm1_cscxx . . $ _gsl_sf_bessel_amp_phase_bm1_cs., z, &ca);
110 const int stat_ct = cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&_gsl_sf_bessel_amp_phase_bth1_cscxx . . $ _gsl_sf_bessel_amp_phase_bth1_cs., z, &ct);
111 const int stat_sp = gsl_sf_bessel_sin_pi4_ecxx . . $ gsl_sf_bessel_sin_pi4_e(38fedf92a6b14b51).(y, ct.valcxx . . $ gsl_sf_result_struct#val./y, &sp);
112 const double sqrty = sqrt(y);
113 const double ampl = (0.75 + ca.valcxx . . $ gsl_sf_result_struct#val.) / sqrty;
114 result->valcxx . . $ gsl_sf_result_struct#val. = (x < 0.0 ? -ampl : ampl) * sp.valcxx . . $ gsl_sf_result_struct#val.;
115 result->errcxx . . $ gsl_sf_result_struct#err. = fabs(sp.valcxx . . $ gsl_sf_result_struct#val.) * ca.errcxx . . $ gsl_sf_result_struct#err./sqrty + fabs(ampl) * sp.errcxx . . $ gsl_sf_result_struct#err.;
116 result->errcxx . . $ gsl_sf_result_struct#err. += GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * fabs(result->valcxx . . $ gsl_sf_result_struct#val.);
117 return GSL_ERROR_SELECT_3cxx . . $ `external/gsl/gsl_errno.h:146:9`!(stat_ca, stat_ct, stat_sp);
118 }
119 }
120
121 /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/
122
123 #include "gsl_specfunc__eval.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__eval.h`/
124
125 double gsl_sf_bessel_J1cxx . . $ gsl_sf_bessel_J1(447c67c6676f75c3).(const double x)
126 {
127 EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_bessel_J1_e(x, &result));
128 }