Extend local PLT reference check
[glibc.git] / math / w_tgamma.c
blob1ca7765e2c38227c2eff2eee86196700db510877
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 <errno.h>
19 #include <math.h>
20 #include <math_private.h>
22 double
23 __tgamma(double x)
25 int local_signgam;
26 double y = __ieee754_gamma_r(x,&local_signgam);
28 if(__glibc_unlikely (!isfinite (y) || y == 0)
29 && (isfinite (x) || isinf (x) < 0)
30 && _LIB_VERSION != _IEEE_) {
31 if (x == 0.0)
32 return __kernel_standard(x,x,50); /* tgamma pole */
33 else if(__floor(x)==x&&x<0.0)
34 return __kernel_standard(x,x,41); /* tgamma domain */
35 else if (y == 0)
36 __set_errno (ERANGE); /* tgamma underflow */
37 else
38 return __kernel_standard(x,x,40); /* tgamma overflow */
40 return local_signgam < 0 ? -y : y;
42 weak_alias (__tgamma, tgamma)
43 #ifdef NO_LONG_DOUBLE
44 strong_alias (__tgamma, __tgammal)
45 weak_alias (__tgamma, tgammal)
46 #endif