[RFA?] Add missing functionality to some math functions
Jeff Johnston
jjohnstn@redhat.com
Thu Feb 12 20:50:00 GMT 2004
Christopher Faylor wrote:
> Do the below patches make any sense? It seems like the non-reentrant versions
> of some of the gamma functions in the libm/mathfp directory are missing.
>
Yes, thanks for noting this. Feel free to check the code in.
-- Jeff J.
> cgf
>
> Index: libm/mathfp/er_gamma.c
> ===================================================================
> RCS file: /cvs/uberbaum/newlib/libm/mathfp/er_gamma.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 er_gamma.c
> --- libm/mathfp/er_gamma.c 5 Dec 2003 06:15:18 -0000 1.4
> +++ libm/mathfp/er_gamma.c 9 Feb 2004 02:31:38 -0000
> @@ -30,3 +30,8 @@
> {
> return exp (lgamma_r(x,signgamp));
> }
> +
> +double gamma(double x)
> +{
> + return gamma_r(x, &(_REENT_SIGNGAM(_REENT)));
> +}
> Index: libm/mathfp/er_lgamma.c
> ===================================================================
> RCS file: /cvs/uberbaum/newlib/libm/mathfp/er_lgamma.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 er_lgamma.c
> --- libm/mathfp/er_lgamma.c 5 Dec 2003 06:15:18 -0000 1.5
> +++ libm/mathfp/er_lgamma.c 9 Feb 2004 02:31:39 -0000
> @@ -422,3 +422,9 @@ static double zero= 0.00000000000000000
> if(hx<0) r = nadj - r;
> return r;
> }
> +
> +double
> +lgamma(double x)
> +{
> + return lgamma_r(x, &(_REENT_SIGNGAM(_REENT)));
> +}
> Index: libm/mathfp/erf_gamma.c
> ===================================================================
> RCS file: /cvs/uberbaum/newlib/libm/mathfp/erf_gamma.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 erf_gamma.c
> --- libm/mathfp/erf_gamma.c 5 Dec 2003 06:15:18 -0000 1.4
> +++ libm/mathfp/erf_gamma.c 9 Feb 2004 02:31:39 -0000
> @@ -16,7 +16,7 @@
>
> /* gammaf_r(x, signgamp)
> * Reentrant version of the logarithm of the Gamma function
> - * with user provide pointer for the sign of Gamma(x).
> + * with user provided pointer for the sign of Gamma(x).
> *
> * Method: See lgammaf_r
> */
> @@ -31,4 +31,9 @@
> #endif
> {
> return expf (lgammaf_r(x,signgamp));
> +}
> +
> +float gammaf(float x)
> +{
> + return gammaf_r(x, &(_REENT_SIGNGAM(_REENT)));
> }
> Index: libm/mathfp/erf_lgamma.c
> ===================================================================
> RCS file: /cvs/uberbaum/newlib/libm/mathfp/erf_lgamma.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 erf_lgamma.c
> --- libm/mathfp/erf_lgamma.c 5 Dec 2003 06:15:18 -0000 1.4
> +++ libm/mathfp/erf_lgamma.c 9 Feb 2004 02:31:39 -0000
> @@ -244,3 +244,8 @@ static float zero= 0.0000000000e+00;
> if(hx<0) r = nadj - r;
> return r;
> }
> +
> +float lgammaf(float x)
> +{
> + return lgammaf_r(x, &(_REENT_SIGNGAM(_REENT)));
> +}
More information about the Newlib
mailing list