diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-11-22 14:04:29 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-11-22 14:04:29 +0000 |
commit | 7ce331c01ce6eb7b3f5c715a38a24359da9c6ee2 (patch) | |
tree | 3a7e8476e868ae15f4da1b7ce26b2db6f434468c /libm/float/i0f.c | |
parent | c117dd5fb183afb1a4790a6f6110d88704be6bf8 (diff) |
Totally rework the math library, this time based on the MacOs X
math library (which is itself based on the math lib from FreeBSD).
-Erik
Diffstat (limited to 'libm/float/i0f.c')
-rw-r--r-- | libm/float/i0f.c | 160 |
1 files changed, 0 insertions, 160 deletions
diff --git a/libm/float/i0f.c b/libm/float/i0f.c deleted file mode 100644 index bb62cf60a..000000000 --- a/libm/float/i0f.c +++ /dev/null @@ -1,160 +0,0 @@ -/* i0f.c - * - * Modified Bessel function of order zero - * - * - * - * SYNOPSIS: - * - * float x, y, i0(); - * - * y = i0f( x ); - * - * - * - * DESCRIPTION: - * - * Returns modified Bessel function of order zero of the - * argument. - * - * The function is defined as i0(x) = j0( ix ). - * - * The range is partitioned into the two intervals [0,8] and - * (8, infinity). Chebyshev polynomial expansions are employed - * in each interval. - * - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE 0,30 100000 4.0e-7 7.9e-8 - * - */ -/* i0ef.c - * - * Modified Bessel function of order zero, - * exponentially scaled - * - * - * - * SYNOPSIS: - * - * float x, y, i0ef(); - * - * y = i0ef( x ); - * - * - * - * DESCRIPTION: - * - * Returns exponentially scaled modified Bessel function - * of order zero of the argument. - * - * The function is defined as i0e(x) = exp(-|x|) j0( ix ). - * - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE 0,30 100000 3.7e-7 7.0e-8 - * See i0f(). - * - */ - -/* i0.c */ - - -/* -Cephes Math Library Release 2.2: June, 1992 -Copyright 1984, 1987, 1992 by Stephen L. Moshier -Direct inquiries to 30 Frost Street, Cambridge, MA 02140 -*/ - -#include <math.h> - -/* Chebyshev coefficients for exp(-x) I0(x) - * in the interval [0,8]. - * - * lim(x->0){ exp(-x) I0(x) } = 1. - */ - -static float A[] = -{ --1.30002500998624804212E-8f, - 6.04699502254191894932E-8f, --2.67079385394061173391E-7f, - 1.11738753912010371815E-6f, --4.41673835845875056359E-6f, - 1.64484480707288970893E-5f, --5.75419501008210370398E-5f, - 1.88502885095841655729E-4f, --5.76375574538582365885E-4f, - 1.63947561694133579842E-3f, --4.32430999505057594430E-3f, - 1.05464603945949983183E-2f, --2.37374148058994688156E-2f, - 4.93052842396707084878E-2f, --9.49010970480476444210E-2f, - 1.71620901522208775349E-1f, --3.04682672343198398683E-1f, - 6.76795274409476084995E-1f -}; - - -/* Chebyshev coefficients for exp(-x) sqrt(x) I0(x) - * in the inverted interval [8,infinity]. - * - * lim(x->inf){ exp(-x) sqrt(x) I0(x) } = 1/sqrt(2pi). - */ - -static float B[] = -{ - 3.39623202570838634515E-9f, - 2.26666899049817806459E-8f, - 2.04891858946906374183E-7f, - 2.89137052083475648297E-6f, - 6.88975834691682398426E-5f, - 3.36911647825569408990E-3f, - 8.04490411014108831608E-1f -}; - - -float chbevlf(float, float *, int), expf(float), sqrtf(float); - -float i0f( float x ) -{ -float y; - -if( x < 0 ) - x = -x; -if( x <= 8.0f ) - { - y = 0.5f*x - 2.0f; - return( expf(x) * chbevlf( y, A, 18 ) ); - } - -return( expf(x) * chbevlf( 32.0f/x - 2.0f, B, 7 ) / sqrtf(x) ); -} - - - -float chbevlf(float, float *, int), expf(float), sqrtf(float); - -float i0ef( float x ) -{ -float y; - -if( x < 0 ) - x = -x; -if( x <= 8.0f ) - { - y = 0.5f*x - 2.0f; - return( chbevlf( y, A, 18 ) ); - } - -return( chbevlf( 32.0f/x - 2.0f, B, 7 ) / sqrtf(x) ); -} |