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