Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
cdf_60.c
Go to the documentation of this file.00001 #include "cdflib.h"
00002 double gamln(double *a)
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 {
00015 static double c0 = .833333333333333e-01;
00016 static double c1 = -.277777777760991e-02;
00017 static double c2 = .793650666825390e-03;
00018 static double c3 = -.595202931351870e-03;
00019 static double c4 = .837308034031215e-03;
00020 static double c5 = -.165322962780713e-02;
00021 static double d = .418938533204673e0;
00022 static double gamln,t,w;
00023 static int i,n;
00024 static double T1;
00025
00026
00027
00028
00029 if(*a > 0.8e0) goto S10;
00030 gamln = gamln1(a)-log(*a);
00031 return gamln;
00032 S10:
00033 if(*a > 2.25e0) goto S20;
00034 t = *a-0.5e0-0.5e0;
00035 gamln = gamln1(&t);
00036 return gamln;
00037 S20:
00038 if(*a >= 10.0e0) goto S40;
00039 n = *a-1.25e0;
00040 t = *a;
00041 w = 1.0e0;
00042 for(i=1; i<=n; i++) {
00043 t -= 1.0e0;
00044 w = t*w;
00045 }
00046 T1 = t-1.0e0;
00047 gamln = gamln1(&T1)+log(w);
00048 return gamln;
00049 S40:
00050 t = pow(1.0e0/ *a,2.0);
00051 w = (((((c5*t+c4)*t+c3)*t+c2)*t+c1)*t+c0)/ *a;
00052 gamln = d+w+(*a-0.5e0)*(log(*a)-1.0e0);
00053 return gamln;
00054 }