| 1 | /* specfunc/elementary.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_elementary.h"cxx . . $ `<file>/external/gsl/gsl_sf_elementary.h`/ |
| 26 | |
| 27 | #include "gsl_specfunc__error.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__error.h`/ |
| 28 | #include "gsl_specfunc__check.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__check.h`/ |
| 29 | |
| 30 | int |
| 31 | gsl_sf_multiply_ecxx . . $ gsl_sf_multiply_e(38fedf92a6b14b51).(const double x, const double y, gsl_sf_resultcxx . . $ gsl_sf_result# * result) |
| 32 | { |
| 33 | const double ax = fabs(x); |
| 34 | const double ay = fabs(y); |
| 35 | |
| 36 | if(x == 0.0 || y == 0.0) { |
| 37 | /* It is necessary to eliminate this immediately. |
| 38 | */ |
| 39 | result->valcxx . . $ gsl_sf_result_struct#val. = 0.0; |
| 40 | result->errcxx . . $ gsl_sf_result_struct#err. = 0.0; |
| 41 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 42 | } |
| 43 | else if((ax <= 1.0 && ay >= 1.0) || (ay <= 1.0 && ax >= 1.0)) { |
| 44 | /* Straddling 1.0 is always safe. |
| 45 | */ |
| 46 | result->valcxx . . $ gsl_sf_result_struct#val. = x*y; |
| 47 | 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.); |
| 48 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 49 | } |
| 50 | else { |
| 51 | const double f = 1.0 - 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`!; |
| 52 | const double min = GSL_MIN_DBLcxx . . $ `external/gsl/gsl_math.h:178:9`!(fabs(x), fabs(y)); |
| 53 | const double max = GSL_MAX_DBLcxx . . $ `external/gsl/gsl_math.h:177:9`!(fabs(x), fabs(y)); |
| 54 | if(max < 0.9 * GSL_SQRT_DBL_MAXcxx . . $ `external/gsl/gsl_machine.h:34:9`! || min < (f * DBL_MAXcxx . . $ `<external>/18143172452841944454/float.h:105:9`!)/max) { |
| 55 | result->valcxx . . $ gsl_sf_result_struct#val. = GSL_COERCE_DBLcxx . . $ `external/gsl/gsl__config.h:255:9`!(x*y); |
| 56 | 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.); |
| 57 | CHECK_UNDERFLOWcxx . . $ `external/gsl/gsl_specfunc__check.h:3:9`!(result); |
| 58 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 59 | } |
| 60 | else { |
| 61 | OVERFLOW_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:1:9`!(result); |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | |
| 67 | int |
| 68 | gsl_sf_multiply_err_ecxx . . $ gsl_sf_multiply_err_e(30e1ceaed94c3433).(const double x, const double dx, |
| 69 | const double y, const double dy, |
| 70 | gsl_sf_resultcxx . . $ gsl_sf_result# * result) |
| 71 | { |
| 72 | int status = gsl_sf_multiply_ecxx . . $ gsl_sf_multiply_e(38fedf92a6b14b51).(x, y, result); |
| 73 | result->errcxx . . $ gsl_sf_result_struct#err. += fabs(dx*y) + fabs(dy*x); |
| 74 | return status; |
| 75 | } |
| 76 | |
| 77 | |
| 78 | /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ |
| 79 | |
| 80 | #include "gsl_specfunc__eval.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__eval.h`/ |
| 81 | |
| 82 | double gsl_sf_multiplycxx . . $ gsl_sf_multiply(d8e7e0733fa41c87).(const double x, const double y) |
| 83 | { |
| 84 | EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_multiply_e(x, y, &result)); |
| 85 | } |
| 86 |