OSDN Git Service

libm/*: mass removal of:
[uclinux-h8/uclibc-ng.git] / libm / w_gamma.c
1 /*
2  * ====================================================
3  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
4  *
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
8  * is preserved.
9  * ====================================================
10  */
11
12 /* double gamma(double x)
13  * Return the logarithm of the Gamma function of x.
14  *
15  * Method: call gamma_r
16  */
17
18 #include <math.h>
19 #include "math_private.h"
20
21 libm_hidden_proto(signgam)
22 double gamma(double x)
23 {
24 #ifdef _IEEE_LIBM
25         return __ieee754_lgamma_r(x,&signgam);
26 #else
27         double y;
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 */
33             else
34                 return __kernel_standard(x,x,40); /* gamma overflow */
35         } else
36             return y;
37 #endif
38 }