base/math/w_lgamma.c

Go to the documentation of this file.
00001 /* @(#)w_lgamma.c 5.1 93/09/24 */
00002 /*
00003  * ====================================================
00004  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00005  *
00006  * Developed at SunPro, a Sun Microsystems, Inc. business.
00007  * Permission to use, copy, modify, and distribute this
00008  * software is freely granted, provided that this notice 
00009  * is preserved.
00010  * ====================================================
00011  */
00012 
00013 #if defined(LIBM_SCCS) && !defined(lint)
00014 static char rcsid[] = "$NetBSD: w_lgamma.c,v 1.6 1995/05/10 20:49:24 jtc Exp $";
00015 #endif
00016 
00017 /* double lgamma(double x)
00018  * Return the logarithm of the Gamma function of x.
00019  *
00020  * Method: call __ieee754_lgamma_r
00021  */
00022 
00023 #include "math.h"
00024 #include "mathP.h"
00025 
00026 extern int signgam;
00027 
00028 #ifdef __STDC__
00029     double lgamma(double x)
00030 #else
00031     double lgamma(x)
00032     double x;
00033 #endif
00034 {
00035 #ifdef _IEEE_LIBM
00036     return __ieee754_lgamma_r(x,&signgam);
00037 #else
00038         double y;
00039         y = __ieee754_lgamma_r(x,&signgam);
00040         if(_LIB_VERSION == _IEEE_) return y;
00041         if(!finite(y)&&finite(x)) {
00042             if(floor(x)==x&&x<=0.0)
00043                 return __kernel_standard(x,x,15); /* lgamma pole */
00044             else
00045                 return __kernel_standard(x,x,14); /* lgamma overflow */
00046         } else
00047             return y;
00048 #endif
00049 }             

Generated on Tue Feb 2 17:46:05 2010 for RTAI API by  doxygen 1.4.7