libio: Improve fortify with clang
[glibc.git] / math / w_lgammal_main.c
blob83e7383d7da78c0567fa767c39c636fd7d1a2f8e
1 /* w_lgammal.c -- long double version of w_lgamma.c.
2 */
4 /*
5 * ====================================================
6 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 * Developed at SunPro, a Sun Microsystems, Inc. business.
9 * Permission to use, copy, modify, and distribute this
10 * software is freely granted, provided that this notice
11 * is preserved.
12 * ====================================================
15 /* long double lgammal(long double x)
16 * Return the logarithm of the Gamma function of x.
18 * Method: call __ieee754_lgammal_r
21 #include <math.h>
22 #include <math_private.h>
23 #include <math-svid-compat.h>
24 #include <libm-alias-ldouble.h>
26 #include <lgamma-compat.h>
28 #if BUILD_LGAMMA
29 long double
30 LGFUNC (__lgammal) (long double x)
32 long double y = CALL_LGAMMA (long double, __ieee754_lgammal_r, x);
33 if(__builtin_expect(!isfinite(y), 0)
34 && isfinite(x) && _LIB_VERSION != _IEEE_)
35 return __kernel_standard_l(x, x,
36 floorl(x)==x&&x<=0.0L
37 ? 215 /* lgamma pole */
38 : 214); /* lgamma overflow */
40 return y;
42 # if USE_AS_COMPAT
43 compat_symbol (libm, __lgammal_compat, lgammal, LGAMMA_OLD_VER);
44 # else
45 versioned_symbol (libm, __lgammal, lgammal, LGAMMA_NEW_VER);
46 libm_alias_ldouble_other (__lgamma, lgamma)
47 # endif
48 # if GAMMA_ALIAS
49 strong_alias (LGFUNC (__lgammal), __gammal)
50 weak_alias (__gammal, gammal)
51 # endif
52 #endif