packaging: add 64bit libs on 32bit build env
[platform/upstream/linaro-glibc.git] / math / w_lgamma.c
1 /* @(#)w_lgamma.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 lgamma(double x)
14  * Return the logarithm of the Gamma function of x.
15  *
16  * Method: call __ieee754_lgamma_r
17  */
18
19 #include <math.h>
20 #include <math_private.h>
21
22 double
23 __lgamma(double x)
24 {
25         int local_signgam = 0;
26         double y = __ieee754_lgamma_r(x,
27                                       _LIB_VERSION != _ISOC_
28                                       /* ISO C99 does not define the
29                                          global variable.  */
30                                       ? &signgam
31                                       : &local_signgam);
32         if(__builtin_expect(!__finite(y), 0)
33            && __finite(x) && _LIB_VERSION != _IEEE_)
34                 return __kernel_standard(x, x,
35                                          __floor(x)==x&&x<=0.0
36                                          ? 15 /* lgamma pole */
37                                          : 14); /* lgamma overflow */
38
39         return y;
40 }
41 weak_alias (__lgamma, lgamma)
42 strong_alias (__lgamma, __gamma)
43 weak_alias (__gamma, gamma)
44 #ifdef NO_LONG_DOUBLE
45 strong_alias (__lgamma, __lgammal)
46 weak_alias (__lgamma, lgammal)
47 strong_alias (__gamma, __gammal)
48 weak_alias (__gamma, gammal)
49 #endif