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_gamma.c,v 1.7 1995/11/20 22:06:43 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 gamma(double x)
00030 #else
00031 double gamma(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,41);
00044 else
00045 return __kernel_standard(x,x,40);
00046 } else
00047 return y;
00048 #endif
00049 }