~ubuntu-branches/ubuntu/natty/eglibc/natty-security

« back to all changes in this revision

Viewing changes to math/w_lgammal.c

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno
  • Date: 2009-05-05 09:54:14 UTC
  • Revision ID: james.westby@ubuntu.com-20090505095414-c45qsg9ixjheohru
ImportĀ upstreamĀ versionĀ 2.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* w_lgammal.c -- long double version of w_lgamma.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 lgammal(long double x)
 
22
 * Return the logarithm of the Gamma function of x.
 
23
 *
 
24
 * Method: call __ieee754_lgammal_r
 
25
 */
 
26
 
 
27
#include <math.h>
 
28
#include "math_private.h"
 
29
 
 
30
#ifdef __STDC__
 
31
        long double __lgammal(long double x)
 
32
#else
 
33
        long double __lgammal(x)
 
34
        long double x;
 
35
#endif
 
36
{
 
37
#ifdef _IEEE_LIBM
 
38
        return __ieee754_lgammal_r(x,&signgam);
 
39
#else
 
40
        long double y;
 
41
        int local_signgam = 0;
 
42
        y = __ieee754_lgammal_r(x,&local_signgam);
 
43
        if (_LIB_VERSION != _ISOC_)
 
44
          /* ISO C99 does not define the global variable.  */
 
45
          signgam = local_signgam;
 
46
        if(_LIB_VERSION == _IEEE_) return y;
 
47
        if(!__finitel(y)&&__finitel(x)) {
 
48
            if(__floorl(x)==x&&x<=0.0)
 
49
                return __kernel_standard(x,x,215); /* lgamma pole */
 
50
            else
 
51
                return __kernel_standard(x,x,214); /* lgamma overflow */
 
52
        } else
 
53
            return y;
 
54
#endif
 
55
}
 
56
weak_alias (__lgammal, lgammal)
 
57
strong_alias (__lgammal, __gammal)
 
58
weak_alias (__gammal, gammal)