diff options
Diffstat (limited to 'sysdeps/libm-ieee754/w_gamma.c')
-rw-r--r-- | sysdeps/libm-ieee754/w_gamma.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sysdeps/libm-ieee754/w_gamma.c b/sysdeps/libm-ieee754/w_gamma.c index 49e4bcf3c3..87a3408c3f 100644 --- a/sysdeps/libm-ieee754/w_gamma.c +++ b/sysdeps/libm-ieee754/w_gamma.c @@ -15,16 +15,13 @@ static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $"; #endif /* double gamma(double x) - * Return the logarithm of the Gamma function of x. - * - * Method: call gamma_r + * Return the logarithm of the Gamma function of x or the Gamma function of x, + * depending on the library mode. */ #include "math.h" #include "math_private.h" -extern int signgam; - #ifdef __STDC__ double __gamma(double x) #else @@ -32,12 +29,19 @@ extern int signgam; double x; #endif { + int signgam; + double y; + if (_LIB_VERSION == _SVID_) + y = __ieee754_lgamma_r(x,&signgam); + else + { + y = __ieee754_gamma_r(x,&signgam); + if (signgam < 0) y = -y; #ifdef _IEEE_LIBM - return __ieee754_lgamma_r(x,&signgam); + return y; #else - double y; - y = __ieee754_lgamma_r(x,&signgam); - if(_LIB_VERSION == _IEEE_) return y; + if(_LIB_VERSION == _IEEE_) return y; + } if(!__finite(y)&&__finite(x)) { if(__floor(x)==x&&x<=0.0) return __kernel_standard(x,x,41); /* gamma pole */ |