OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libm/] [math/] [w_tgamma.c] - Blame information for rev 345

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* @(#)w_gamma.c 5.1 93/09/24 */
2
/*
3
 * ====================================================
4
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5
 *
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
9
 * is preserved.
10
 * ====================================================
11
 */
12
 
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.
16
 */
17
 
18
#include "fdlibm.h"
19
 
20
#ifdef __STDC__
21
        double tgamma(double x)
22
#else
23
        double tgamma(x)
24
        double x;
25
#endif
26
{
27
        double y;
28
        int local_signgam;
29
        y = __ieee754_gamma_r(x,&local_signgam);
30
        if (local_signgam < 0) y = -y;
31
#ifdef _IEEE_LIBM
32
        return y;
33
#else
34
        if(_LIB_VERSION == _IEEE_) return y;
35
 
36
        if(!finite(y)&&finite(x)) {
37
          if(floor(x)==x&&x<=0.0)
38
            return __kernel_standard(x,x,41); /* tgamma pole */
39
          else
40
            return __kernel_standard(x,x,40); /* tgamma overflow */
41
        }
42
        return y;
43
#endif
44
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.