From 532fe1553e4803a0e205616ac713e5ec8014f7e4 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Thu, 12 Feb 2015 13:25:30 +0100 Subject: [PATCH] Remove the non-standard gamma() function. Use lgamma() instead. --- include/openlibm_math.h | 16 ++++------------ src/Make.files | 4 ++-- src/common.c | 2 ++ src/e_gamma.c | 36 ------------------------------------ src/e_gamma_r.c | 33 --------------------------------- src/e_gammaf.c | 37 ------------------------------------- src/e_gammaf_r.c | 34 ---------------------------------- src/math_private.h | 4 ---- 8 files changed, 8 insertions(+), 158 deletions(-) delete mode 100644 src/e_gamma.c delete mode 100644 src/e_gamma_r.c delete mode 100644 src/e_gammaf.c delete mode 100644 src/e_gammaf_r.c diff --git a/include/openlibm_math.h b/include/openlibm_math.h index 8605c8b..a3eb614 100644 --- a/include/openlibm_math.h +++ b/include/openlibm_math.h @@ -281,10 +281,6 @@ double y0(double); double y1(double); double yn(int, double); -#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE -double gamma(double); -#endif - #if __XSI_VISIBLE <= 600 || __BSD_VISIBLE double scalb(double, double); #endif @@ -312,10 +308,9 @@ int finite(double) __pure2; int isnanf(float) __pure2; /* - * Reentrant version of gamma & lgamma; passes signgam back by reference - * as the second argument; user must allocate space for signgam. + * Reentrant version of lgamma; passes signgam back by reference as the + * second argument; user must allocate space for signgam. */ -double gamma_r(double, int *); double lgamma_r(double, int *); /* @@ -402,7 +397,6 @@ float fminf(float, float) __pure2; #if __BSD_VISIBLE float dremf(float, float); int finitef(float) __pure2; -float gammaf(float); float j0f(float); float j1f(float); float jnf(int, float); @@ -412,11 +406,9 @@ float y1f(float); float ynf(int, float); /* - * Float versions of reentrant version of gamma & lgamma; passes - * signgam back by reference as the second argument; user must - * allocate space for signgam. + * Float versions of reentrant version of lgamma; passes signgam back by + * reference as the second argument; user must allocate space for signgam. */ -float gammaf_r(float, int *); float lgammaf_r(float, int *); /* diff --git a/src/Make.files b/src/Make.files index edd64e4..5c75e93 100644 --- a/src/Make.files +++ b/src/Make.files @@ -1,8 +1,8 @@ $(CUR_SRCS) = common.c \ e_acos.c e_acosf.c e_acosh.c e_acoshf.c e_asin.c e_asinf.c \ e_atan2.c e_atan2f.c e_atanh.c e_atanhf.c e_cosh.c e_coshf.c e_exp.c \ - e_expf.c e_fmod.c e_fmodf.c e_gamma.c e_gamma_r.c e_gammaf.c \ - e_gammaf_r.c e_hypot.c e_hypotf.c e_j0.c e_j0f.c e_j1.c e_j1f.c \ + e_expf.c e_fmod.c e_fmodf.c \ + e_hypot.c e_hypotf.c e_j0.c e_j0f.c e_j1.c e_j1f.c \ e_jn.c e_jnf.c e_lgamma.c e_lgamma_r.c e_lgammaf.c e_lgammaf_r.c \ e_lgammal.c e_log.c e_log10.c e_log10f.c e_log2.c e_log2f.c e_logf.c \ e_pow.c e_powf.c e_remainder.c e_remainderf.c e_scalb.c e_scalbf.c \ diff --git a/src/common.c b/src/common.c index 01df0db..5905c20 100644 --- a/src/common.c +++ b/src/common.c @@ -1,5 +1,7 @@ #include "math_private.h" +DLLEXPORT int isopenlibm(void); + DLLEXPORT int isopenlibm(void) { return 1; } diff --git a/src/e_gamma.c b/src/e_gamma.c deleted file mode 100644 index ea6e7e0..0000000 --- a/src/e_gamma.c +++ /dev/null @@ -1,36 +0,0 @@ - -/* @(#)e_gamma.c 1.3 95/01/18 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - * - */ - -#include "cdefs-compat.h" -//__FBSDID("$FreeBSD: src/lib/msun/src/e_gamma.c,v 1.8 2008/02/22 02:30:34 das Exp $"); - -/* __ieee754_gamma(x) - * Return the logarithm of the Gamma function of x. - * - * Method: call __ieee754_gamma_r - */ - -#include - -#include "math_private.h" - -DLLEXPORT double -__ieee754_gamma(double x) -{ -#ifdef OPENLIBM_ONLY_THREAD_SAFE - int signgam; -#endif - - return __ieee754_gamma_r(x,&signgam); -} diff --git a/src/e_gamma_r.c b/src/e_gamma_r.c deleted file mode 100644 index 36a92a1..0000000 --- a/src/e_gamma_r.c +++ /dev/null @@ -1,33 +0,0 @@ - -/* @(#)e_gamma_r.c 1.3 95/01/18 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunSoft, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - * - */ - -#include "cdefs-compat.h" -//__FBSDID("$FreeBSD: src/lib/msun/src/e_gamma_r.c,v 1.8 2008/02/22 02:30:34 das Exp $"); - -/* __ieee754_gamma_r(x, signgamp) - * Reentrant version of the logarithm of the Gamma function - * with user provide pointer for the sign of Gamma(x). - * - * Method: See __ieee754_lgamma_r - */ - -#include - -#include "math_private.h" - -DLLEXPORT double -__ieee754_gamma_r(double x, int *signgamp) -{ - return __ieee754_lgamma_r(x,signgamp); -} diff --git a/src/e_gammaf.c b/src/e_gammaf.c deleted file mode 100644 index a4c88ad..0000000 --- a/src/e_gammaf.c +++ /dev/null @@ -1,37 +0,0 @@ -/* e_gammaf.c -- float version of e_gamma.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "cdefs-compat.h" -//__FBSDID("$FreeBSD: src/lib/msun/src/e_gammaf.c,v 1.7 2008/02/22 02:30:35 das Exp $"); - -/* __ieee754_gammaf(x) - * Return the logarithm of the Gamma function of x. - * - * Method: call __ieee754_gammaf_r - */ - -#include - -#include "math_private.h" - -DLLEXPORT float -__ieee754_gammaf(float x) -{ -#ifdef OPENLIBM_ONLY_THREAD_SAFE - int signgam; -#endif - - return __ieee754_gammaf_r(x,&signgam); -} diff --git a/src/e_gammaf_r.c b/src/e_gammaf_r.c deleted file mode 100644 index 7041118..0000000 --- a/src/e_gammaf_r.c +++ /dev/null @@ -1,34 +0,0 @@ -/* e_gammaf_r.c -- float version of e_gamma_r.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#include "cdefs-compat.h" -//__FBSDID("$FreeBSD: src/lib/msun/src/e_gammaf_r.c,v 1.8 2008/02/22 02:30:35 das Exp $"); - -/* __ieee754_gammaf_r(x, signgamp) - * Reentrant version of the logarithm of the Gamma function - * with user provide pointer for the sign of Gamma(x). - * - * Method: See __ieee754_lgammaf_r - */ - -#include - -#include "math_private.h" - -DLLEXPORT float -__ieee754_gammaf_r(float x, int *signgamp) -{ - return __ieee754_lgammaf_r(x,signgamp); -} diff --git a/src/math_private.h b/src/math_private.h index 1ab2309..7f96cf7 100644 --- a/src/math_private.h +++ b/src/math_private.h @@ -280,9 +280,7 @@ irint(double x) #define __ieee754_fmod fmod #define __ieee754_pow pow #define __ieee754_lgamma lgamma -#define __ieee754_gamma gamma #define __ieee754_lgamma_r lgamma_r -#define __ieee754_gamma_r gamma_r #define __ieee754_log10 log10 #define __ieee754_sinh sinh #define __ieee754_hypot hypot @@ -306,9 +304,7 @@ irint(double x) #define __ieee754_fmodf fmodf #define __ieee754_powf powf #define __ieee754_lgammaf lgammaf -#define __ieee754_gammaf gammaf #define __ieee754_lgammaf_r lgammaf_r -#define __ieee754_gammaf_r gammaf_r #define __ieee754_log10f log10f #define __ieee754_log2f log2f #define __ieee754_sinhf sinhf