]> git.ipfire.org Git - thirdparty/glibc.git/blob - math/w_tgammal.c
Use private math_private.h in files in math/
[thirdparty/glibc.git] / math / w_tgammal.c
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 */
5
6 /*
7 * ====================================================
8 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9 *
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 * ====================================================
15 */
16
17 #if defined(LIBM_SCCS) && !defined(lint)
18 static char rcsid[] = "$NetBSD: $";
19 #endif
20
21 /* long double gammal(double x)
22 * Return the Gamma function of x.
23 */
24
25 #include <math.h>
26 #include <math_private.h>
27
28 #ifdef __STDC__
29 long double __tgammal(long double x)
30 #else
31 long double __tgammal(x)
32 long double x;
33 #endif
34 {
35 long double y;
36 int local_signgam;
37 y = __ieee754_gammal_r(x,&local_signgam);
38 if (local_signgam < 0) y = -y;
39 #ifdef _IEEE_LIBM
40 return y;
41 #else
42 if(_LIB_VERSION == _IEEE_) return y;
43
44 if(!__finitel(y)&&__finitel(x)) {
45 if(x==0.0)
46 return __kernel_standard(x,x,250); /* tgamma pole */
47 else if(__floorl(x)==x&&x<0.0)
48 return __kernel_standard(x,x,241); /* tgamma domain */
49 else
50 return __kernel_standard(x,x,240); /* tgamma overflow */
51 }
52 return y;
53 #endif
54 }
55 weak_alias (__tgammal, tgammal)