Move _dl_important_hwcaps to dl-hwcaps.c
[platform/upstream/glibc.git] / math / w_tgamma.c
1 /* @(#)w_gamma.c 5.1 93/09/24 */
2 /*
3  * ====================================================
4  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5  *
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  * ====================================================
11  */
12
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.
16  */
17
18 #include <math.h>
19 #include <math_private.h>
20
21 double
22 __tgamma(double x)
23 {
24         int local_signgam;
25         double y = __ieee754_gamma_r(x,&local_signgam);
26
27         if(__builtin_expect(!__finite(y), 0)&&__finite(x)
28            && _LIB_VERSION != _IEEE_) {
29           if (x == 0.0)
30             return __kernel_standard(x,x,50); /* tgamma pole */
31           else if(__floor(x)==x&&x<0.0)
32             return __kernel_standard(x,x,41); /* tgamma domain */
33           else
34             return __kernel_standard(x,x,40); /* tgamma overflow */
35         }
36         return local_signgam < 0 ? -y : y;
37 }
38 weak_alias (__tgamma, tgamma)
39 #ifdef NO_LONG_DOUBLE
40 strong_alias (__tgamma, __tgammal)
41 weak_alias (__tgamma, tgammal)
42 #endif