fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libm / math / w_tgamma.c
blobf24a243bfd0ce31021559d7d6d879ecf65081406
1 /* @(#)w_gamma.c 5.1 93/09/24 */
2 /*
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
9 * is preserved.
10 * ====================================================
13 /* double gamma(double x)
14 * Return the logarithm of the Gamma function of x or the Gamma function of x,
15 * depending on the library mode.
18 #include "fdlibm.h"
20 #ifdef __STDC__
21 double tgamma(double x)
22 #else
23 double tgamma(x)
24 double x;
25 #endif
27 double y;
28 int local_signgam;
29 y = __ieee754_gamma_r(x,&local_signgam);
30 if (local_signgam < 0) y = -y;
31 #ifdef _IEEE_LIBM
32 return y;
33 #else
34 if(_LIB_VERSION == _IEEE_) return y;
36 if(!finite(y)&&finite(x)) {
37 if(floor(x)==x&&x<=0.0)
38 return __kernel_standard(x,x,41); /* tgamma pole */
39 else
40 return __kernel_standard(x,x,40); /* tgamma overflow */
42 return y;
43 #endif