~ubuntu-branches/ubuntu/precise/eglibc/precise-201308281639

« back to all changes in this revision

Viewing changes to math/w_tgamma.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-02-08 01:58:09 UTC
  • mfrom: (1.5.3) (288.1.12 precise)
  • Revision ID: package-import@ubuntu.com-20120208015809-ulscst7uteq3e22z
Tags: 2.15~pre6-0ubuntu10
Merge from Debian (r5151, 2.13-26).

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 * ====================================================
11
11
 */
12
12
 
13
 
#if defined(LIBM_SCCS) && !defined(lint)
14
 
static char rcsid[] = "$NetBSD: w_gamma.c,v 1.7 1995/11/20 22:06:43 jtc Exp $";
15
 
#endif
16
 
 
17
13
/* double gamma(double x)
18
14
 * Return  the logarithm of the Gamma function of x or the Gamma function of x,
19
15
 * depending on the library mode.
20
16
 */
21
17
 
22
18
#include <math.h>
23
 
#include "math_private.h"
 
19
#include <math_private.h>
24
20
 
25
 
#ifdef __STDC__
26
 
        double __tgamma(double x)
27
 
#else
28
 
        double __tgamma(x)
29
 
        double x;
30
 
#endif
 
21
double
 
22
__tgamma(double x)
31
23
{
32
 
        double y;
33
24
        int local_signgam;
34
 
        y = __ieee754_gamma_r(x,&local_signgam);
35
 
        if (local_signgam < 0) y = -y;
36
 
#ifdef _IEEE_LIBM
37
 
        return y;
38
 
#else
39
 
        if(_LIB_VERSION == _IEEE_) return y;
 
25
        double y = __ieee754_gamma_r(x,&local_signgam);
40
26
 
41
 
        if(!__finite(y)&&__finite(x)) {
 
27
        if(__builtin_expect(!__finite(y), 0)&&__finite(x)
 
28
           && _LIB_VERSION != _IEEE_) {
42
29
          if (x == 0.0)
43
30
            return __kernel_standard(x,x,50); /* tgamma pole */
44
31
          else if(__floor(x)==x&&x<0.0)
46
33
          else
47
34
            return __kernel_standard(x,x,40); /* tgamma overflow */
48
35
        }
49
 
        return y;
50
 
#endif
 
36
        return local_signgam < 0 ? -y : y;
51
37
}
52
38
weak_alias (__tgamma, tgamma)
53
39
#ifdef NO_LONG_DOUBLE