00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
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 
00018 
00019 
00020 
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); 
00044             else
00045                 return __kernel_standard(x,x,14); 
00046         } else
00047             return y;
00048 #endif
00049 }