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#include <math-svid-compat.h>
22#include <libm-alias-double.h>
23
24#include <lgamma-compat.h>
25
26#if BUILD_LGAMMA
27double
28LGFUNC (__lgamma) (double x)
29{
30 double y = CALL_LGAMMA (double, __ieee754_lgamma_r, x);
31 if(__builtin_expect(!isfinite(y), 0)
32 && isfinite(x) && _LIB_VERSION != _IEEE_)
33 return __kernel_standard(x, x,
34 floor(x)==x&&x<=0.0
35 ? 15 /* lgamma pole */
36 : 14); /* lgamma overflow */
37
38 return y;
39}
40# if USE_AS_COMPAT
41compat_symbol (libm, __lgamma_compat, lgamma, LGAMMA_OLD_VER);
42# ifdef NO_LONG_DOUBLE
43strong_alias (__lgamma_compat, __lgammal_compat)
44compat_symbol (libm, __lgammal_compat, lgammal, LGAMMA_OLD_VER);
45# endif
46# else
47versioned_symbol (libm, __lgamma, lgamma, LGAMMA_NEW_VER);
48# ifdef NO_LONG_DOUBLE
49strong_alias (__lgamma, __lgammal)
50versioned_symbol (libm, __lgammal, lgammal, LGAMMA_NEW_VER);
51# endif
52libm_alias_double_other (__lgamma, lgamma)
53# endif
54# if GAMMA_ALIAS
55strong_alias (LGFUNC (__lgamma), __gamma)
56weak_alias (__gamma, gamma)
57# ifdef NO_LONG_DOUBLE
58strong_alias (__gamma, __gammal)
59weak_alias (__gamma, gammal)
60# endif
61# endif
62#endif
63

source code of glibc/math/w_lgamma_main.c