ia64: msg.h: fix msg_qnum/msg_qbytes types
[glibc.git] / math / w_tgammal.c
blobb3a9e4a01587f56000a709e12ae8a1375b9e5a1d
1 /* w_gammal.c -- long double version of w_gamma.c.
2 * Conversion to long double by Ulrich Drepper,
3 * Cygnus Support, drepper@cygnus.com.
4 */
6 /*
7 * ====================================================
8 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
10 * Developed at SunPro, a Sun Microsystems, Inc. business.
11 * Permission to use, copy, modify, and distribute this
12 * software is freely granted, provided that this notice
13 * is preserved.
14 * ====================================================
17 /* long double gammal(double x)
18 * Return the Gamma function of x.
21 #include <errno.h>
22 #include <math.h>
23 #include <math_private.h>
25 long double
26 __tgammal(long double x)
28 int local_signgam;
29 long double y = __ieee754_gammal_r(x,&local_signgam);
31 if(__glibc_unlikely (!isfinite (y) || y == 0)
32 && (isfinite (x) || isinf (x) < 0)
33 && _LIB_VERSION != _IEEE_) {
34 if(x==0.0)
35 return __kernel_standard_l(x,x,250); /* tgamma pole */
36 else if(__floorl(x)==x&&x<0.0L)
37 return __kernel_standard_l(x,x,241); /* tgamma domain */
38 else if (y == 0)
39 __set_errno (ERANGE); /* tgamma underflow */
40 else
41 return __kernel_standard_l(x,x,240); /* tgamma overflow */
43 return local_signgam < 0 ? - y : y;
45 weak_alias (__tgammal, tgammal)