Update.
[glibc.git] / sysdeps / libm-ieee754 / w_gammal.c
blob68328f652a9ee40b8e545eb5025304a837c5bbaa
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 #if defined(LIBM_SCCS) && !defined(lint)
18 static char rcsid[] = "$NetBSD: $";
19 #endif
21 /* long double gammal(double x)
22 * Return the Gamma function of x.
25 #include "math.h"
26 #include "math_private.h"
28 #ifdef __STDC__
29 long double __gammal(long double x)
30 #else
31 long double __gammal(x)
32 long double x;
33 #endif
35 long double y;
36 #ifndef _IEEE_LIBM
37 if (_LIB_VERSION == _SVID_)
39 y = __ieee754_lgammal_r(x,&signgam);
41 if(!__finitel(y)&&__finitel(x)) {
42 if(__floorl(x)==x&&x<=(long double)0.0)
43 /* lgamma pole */
44 return (long double)__kernel_standard((double)x,(double)x,15);
45 else
46 /* lgamma overflow */
47 return (long double)__kernel_standard((double)x,(double)x,14);
50 else
52 #endif
53 int local_signgam;
54 y = __ieee754_gammal_r(x,&local_signgam);
55 if (local_signgam < 0) y = -y;
56 #ifdef _IEEE_LIBM
57 return y;
58 #else
59 if(_LIB_VERSION == _IEEE_) return y;
61 if(!__finitel(y)&&__finitel(x)) {
62 if(__floorl(x)==x&&x<=0.0)
63 return __kernel_standard(x,x,241); /* gamma pole */
64 else
65 return __kernel_standard(x,x,240); /* gamma overflow */
68 return y;
69 #endif
71 weak_alias (__gammal, gammal)