2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 * Developed at SunPro, a Sun Microsystems, Inc. business.
6 * Permission to use, copy, modify, and distribute this
7 * software is freely granted, provided that this notice
9 * ====================================================
12 /* double gamma(double x)
13 * Return the logarithm of the Gamma function of x.
15 * Method: call gamma_r
19 #include "math_private.h"
21 libm_hidden_proto(signgam)
22 double gamma(double x)
25 return __ieee754_lgamma_r(x,&signgam);
28 y = __ieee754_lgamma_r(x,&signgam);
29 if(_LIB_VERSION == _IEEE_) return y;
30 if(!isfinite(y)&&isfinite(x)) {
31 if(floor(x)==x&&x<=0.0)
32 return __kernel_standard(x,x,41); /* gamma pole */
34 return __kernel_standard(x,x,40); /* gamma overflow */