| 1 | /* specfunc/shint.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_expint.h"cxx . . $ `<file>/external/gsl/gsl_sf_expint.h`/ |
| 26 | |
| 27 | #include "gsl_specfunc__error.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__error.h`/ |
| 28 | |
| 29 | #include "gsl_specfunc__chebyshev.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__chebyshev.h`/ |
| 30 | #include "gsl_specfunc__cheb_eval.c"cxx . . $ `<file>/external/gsl/gsl_specfunc__cheb_eval.c`/ |
| 31 | |
| 32 | /*-*-*-*-*-*-*-*-*-*-*-* Private Section *-*-*-*-*-*-*-*-*-*-*-*/ |
| 33 | |
| 34 | /* based on SLATEC shi.f, W. Fullerton |
| 35 | |
| 36 | series for shi on the interval 0.00000e+00 to 1.40625e-01 |
| 37 | with weighted error 4.67e-20 |
| 38 | log weighted error 19.33 |
| 39 | significant figures required 17.07 |
| 40 | decimal places required 19.75 |
| 41 | */ |
| 42 | static double shi_datacxx . . $ shi_data.[7] = { |
| 43 | 0.0078372685688900950695, |
| 44 | 0.0039227664934234563973, |
| 45 | 0.0000041346787887617267, |
| 46 | 0.0000000024707480372883, |
| 47 | 0.0000000000009379295591, |
| 48 | 0.0000000000000002451817, |
| 49 | 0.0000000000000000000467 |
| 50 | }; |
| 51 | static cheb_seriescxx . . $ cheb_series# shi_cscxx . . $ shi_cs. = { |
| 52 | shi_datacxx . . $ shi_data., |
| 53 | 6, |
| 54 | -1, 1, |
| 55 | 6 |
| 56 | }; |
| 57 | |
| 58 | |
| 59 | /*-*-*-*-*-*-*-*-*-*-*-* Functions with Error Codes *-*-*-*-*-*-*-*-*-*-*-*/ |
| 60 | |
| 61 | int gsl_sf_Shi_ecxx . . $ gsl_sf_Shi_e(feafd9287608bc44).(const double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result) |
| 62 | { |
| 63 | const double xsml = GSL_SQRT_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:18:9`!; /* sqrt (r1mach(3)) */ |
| 64 | const double ax = fabs(x); |
| 65 | |
| 66 | if(ax < xsml) { |
| 67 | result->valcxx . . $ gsl_sf_result_struct#val. = x; |
| 68 | result->errcxx . . $ gsl_sf_result_struct#err. = 0.0; |
| 69 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 70 | } |
| 71 | else if(ax <= 0.375) { |
| 72 | gsl_sf_resultcxx . . $ gsl_sf_result# result_c; |
| 73 | cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&shi_cscxx . . $ shi_cs., 128.0*x*x/9.0-1.0, &result_c); |
| 74 | result->valcxx . . $ gsl_sf_result_struct#val. = x * (1.0 + result_c.valcxx . . $ gsl_sf_result_struct#val.); |
| 75 | result->errcxx . . $ gsl_sf_result_struct#err. = x * result_c.errcxx . . $ gsl_sf_result_struct#err.; |
| 76 | result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * fabs(result->valcxx . . $ gsl_sf_result_struct#val.); |
| 77 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 78 | } |
| 79 | else { |
| 80 | gsl_sf_resultcxx . . $ gsl_sf_result# result_Ei; |
| 81 | gsl_sf_resultcxx . . $ gsl_sf_result# result_E1; |
| 82 | int status_Ei = gsl_sf_expint_Ei_ecxx . . $ gsl_sf_expint_Ei_e(feafd9287608bc44).(x, &result_Ei); |
| 83 | int status_E1 = gsl_sf_expint_E1_ecxx . . $ gsl_sf_expint_E1_e(feafd9287608bc44).(x, &result_E1); |
| 84 | result->valcxx . . $ gsl_sf_result_struct#val. = 0.5*(result_Ei.valcxx . . $ gsl_sf_result_struct#val. + result_E1.valcxx . . $ gsl_sf_result_struct#val.); |
| 85 | result->errcxx . . $ gsl_sf_result_struct#err. = 0.5*(result_Ei.errcxx . . $ gsl_sf_result_struct#err. + result_E1.errcxx . . $ gsl_sf_result_struct#err.); |
| 86 | result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * fabs(result->valcxx . . $ gsl_sf_result_struct#val.); |
| 87 | if(status_Ei == GSL_EUNDRFLWcxx . . $ GSL_EUNDRFLW. && status_E1 == GSL_EUNDRFLWcxx . . $ GSL_EUNDRFLW.) { |
| 88 | GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("underflow", GSL_EUNDRFLW); |
| 89 | } |
| 90 | else if(status_Ei == GSL_EOVRFLWcxx . . $ GSL_EOVRFLW. || status_E1 == GSL_EOVRFLWcxx . . $ GSL_EOVRFLW.) { |
| 91 | GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("overflow", GSL_EOVRFLW); |
| 92 | } |
| 93 | else { |
| 94 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | |
| 100 | int gsl_sf_Chi_ecxx . . $ gsl_sf_Chi_e(feafd9287608bc44).(const double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result) |
| 101 | { |
| 102 | gsl_sf_resultcxx . . $ gsl_sf_result# result_Ei; |
| 103 | gsl_sf_resultcxx . . $ gsl_sf_result# result_E1; |
| 104 | int status_Ei = gsl_sf_expint_Ei_ecxx . . $ gsl_sf_expint_Ei_e(feafd9287608bc44).(x, &result_Ei); |
| 105 | int status_E1 = gsl_sf_expint_E1_ecxx . . $ gsl_sf_expint_E1_e(feafd9287608bc44).(x, &result_E1); |
| 106 | if(status_Ei == GSL_EDOMcxx . . $ GSL_EDOM. || status_E1 == GSL_EDOMcxx . . $ GSL_EDOM.) { |
| 107 | DOMAIN_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:9:9`!(result); |
| 108 | } |
| 109 | else if(status_Ei == GSL_EUNDRFLWcxx . . $ GSL_EUNDRFLW. && status_E1 == GSL_EUNDRFLWcxx . . $ GSL_EUNDRFLW.) { |
| 110 | UNDERFLOW_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:3:9`!(result); |
| 111 | } |
| 112 | else if(status_Ei == GSL_EOVRFLWcxx . . $ GSL_EOVRFLW. || status_E1 == GSL_EOVRFLWcxx . . $ GSL_EOVRFLW.) { |
| 113 | OVERFLOW_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:1:9`!(result); |
| 114 | } |
| 115 | else { |
| 116 | result->valcxx . . $ gsl_sf_result_struct#val. = 0.5 * (result_Ei.valcxx . . $ gsl_sf_result_struct#val. - result_E1.valcxx . . $ gsl_sf_result_struct#val.); |
| 117 | result->errcxx . . $ gsl_sf_result_struct#err. = 0.5 * (result_Ei.errcxx . . $ gsl_sf_result_struct#err. + result_E1.errcxx . . $ gsl_sf_result_struct#err.); |
| 118 | result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * fabs(result->valcxx . . $ gsl_sf_result_struct#val.); |
| 119 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ |
| 124 | |
| 125 | #include "gsl_specfunc__eval.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__eval.h`/ |
| 126 | |
| 127 | double gsl_sf_Shicxx . . $ gsl_sf_Shi(447c67c6676f75c3).(const double x) |
| 128 | { |
| 129 | EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_Shi_e(x, &result)); |
| 130 | } |
| 131 | |
| 132 | double gsl_sf_Chicxx . . $ gsl_sf_Chi(447c67c6676f75c3).(const double x) |
| 133 | { |
| 134 | EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_Chi_e(x, &result)); |
| 135 | } |