elf: Do not set invalid tunables values
[glibc.git] / math / w_tgammal_compat.c
bloba15f6ac0a3b535216289a1e67e16a53f4d8884fe
1 /* w_gammal.c -- long double version of w_gamma.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 gammal(double x)
16 * Return the Gamma function of x.
19 #include <errno.h>
20 #include <math.h>
21 #include <math_private.h>
22 #include <math-svid-compat.h>
23 #include <libm-alias-ldouble.h>
25 #if LIBM_SVID_COMPAT
26 long double
27 __tgammal(long double x)
29 int local_signgam;
30 long double y = __ieee754_gammal_r(x,&local_signgam);
32 if(__glibc_unlikely (!isfinite (y) || y == 0)
33 && (isfinite (x) || (isinf (x) && x < 0.0))
34 && _LIB_VERSION != _IEEE_) {
35 if(x==0.0)
36 return __kernel_standard_l(x,x,250); /* tgamma pole */
37 else if(floorl(x)==x&&x<0.0L)
38 return __kernel_standard_l(x,x,241); /* tgamma domain */
39 else if (y == 0)
40 __set_errno (ERANGE); /* tgamma underflow */
41 else
42 return __kernel_standard_l(x,x,240); /* tgamma overflow */
44 return local_signgam < 0 ? - y : y;
46 libm_alias_ldouble (__tgamma, tgamma)
47 #endif