Back to index

glibc  2.9
w_lgammal.c
Go to the documentation of this file.
00001 /* w_lgammal.c -- long double version of w_lgamma.c.
00002  * Conversion to long double by Ulrich Drepper,
00003  * Cygnus Support, drepper@cygnus.com.
00004  */
00005 
00006 /*
00007  * ====================================================
00008  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00009  *
00010  * Developed at SunPro, a Sun Microsystems, Inc. business.
00011  * Permission to use, copy, modify, and distribute this
00012  * software is freely granted, provided that this notice
00013  * is preserved.
00014  * ====================================================
00015  */
00016 
00017 #if defined(LIBM_SCCS) && !defined(lint)
00018 static char rcsid[] = "$NetBSD: $";
00019 #endif
00020 
00021 /* long double lgammal(long double x)
00022  * Return the logarithm of the Gamma function of x.
00023  *
00024  * Method: call __ieee754_lgammal_r
00025  */
00026 
00027 #include <math.h>
00028 #include "math_private.h"
00029 
00030 #ifdef __STDC__
00031        long double __lgammal(long double x)
00032 #else
00033        long double __lgammal(x)
00034        long double x;
00035 #endif
00036 {
00037 #ifdef _IEEE_LIBM
00038        return __ieee754_lgammal_r(x,&signgam);
00039 #else
00040         long double y;
00041        int local_signgam = 0;
00042         y = __ieee754_lgammal_r(x,&local_signgam);
00043        if (_LIB_VERSION != _ISOC_)
00044          /* ISO C99 does not define the global variable.  */
00045          signgam = local_signgam;
00046         if(_LIB_VERSION == _IEEE_) return y;
00047         if(!__finitel(y)&&__finitel(x)) {
00048             if(__floorl(x)==x&&x<=0.0)
00049                 return __kernel_standard(x,x,215); /* lgamma pole */
00050             else
00051                 return __kernel_standard(x,x,214); /* lgamma overflow */
00052         } else
00053             return y;
00054 #endif
00055 }
00056 weak_alias (__lgammal, lgammal)
00057 strong_alias (__lgammal, __gammal)
00058 weak_alias (__gammal, gammal)