1 /* w_gammal.c -- long double version of w_gamma.c.
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
12 * ====================================================
15 /* long double gammal(double x)
16 * Return the Gamma function of x.
21 #include <math_private.h>
22 #include <math-svid-compat.h>
23 #include <libm-alias-ldouble.h>
27 __tgammal(long double x)
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_) {
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 */
40 __set_errno (ERANGE); /* tgamma underflow */
42 return __kernel_standard_l(x,x,240); /* tgamma overflow */
44 return local_signgam < 0 ? - y : y;
46 libm_alias_ldouble (__tgamma, tgamma)