1 /* @(#)w_gamma.c 5.1 93/09/24 */
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
10 * ====================================================
13 /* double gamma(double x)
14 * Return the logarithm of the Gamma function of x or the Gamma function of x,
15 * depending on the library mode.
19 #include <math_private.h>
25 double y = __ieee754_gamma_r(x,&local_signgam);
27 if(__builtin_expect(!__finite(y), 0)
28 && (__finite (x) || __isinf (x) < 0)
29 && _LIB_VERSION != _IEEE_) {
31 return __kernel_standard(x,x,50); /* tgamma pole */
32 else if(__floor(x)==x&&x<0.0)
33 return __kernel_standard(x,x,41); /* tgamma domain */
35 return __kernel_standard(x,x,40); /* tgamma overflow */
37 return local_signgam < 0 ? -y : y;
39 weak_alias (__tgamma, tgamma)
41 strong_alias (__tgamma, __tgammal)
42 weak_alias (__tgamma, tgammal)