Back to index

glibc  2.9
w_tgammal.c
Go to the documentation of this file.
00001 /* w_gammal.c -- long double version of w_gamma.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 gammal(double x)
00022  * Return the Gamma function of x.
00023  */
00024 
00025 #include <math.h>
00026 #include "math_private.h"
00027 
00028 #ifdef __STDC__
00029        long double __tgammal(long double x)
00030 #else
00031        long double __tgammal(x)
00032        long double x;
00033 #endif
00034 {
00035         long double y;
00036        int local_signgam;
00037        y = __ieee754_gammal_r(x,&local_signgam);
00038        if (local_signgam < 0) y = -y;
00039 #ifdef _IEEE_LIBM
00040        return y;
00041 #else
00042        if(_LIB_VERSION == _IEEE_) return y;
00043 
00044        if(!__finitel(y)&&__finitel(x)) {
00045          if(x==0.0)
00046            return __kernel_standard(x,x,250); /* tgamma pole */
00047          else if(__floorl(x)==x&&x<0.0)
00048            return __kernel_standard(x,x,241); /* tgamma domain */
00049          else
00050            return __kernel_standard(x,x,240); /* tgamma overflow */
00051        }
00052        return y;
00053 #endif
00054 }
00055 weak_alias (__tgammal, tgammal)