Doxygen Source Code Documentation
cdf_47.c File Reference
#include "cdflib.h"
Go to the source code of this file.
Functions | |
double | dlngam (double *a) |
Function Documentation
|
Definition at line 2 of file cdf_47.c. References a, dlngam(), gamln1(), and i. Referenced by dlngam(), and dstrem().
00026 : 00027 DiDinato, A. R. and Morris, A. H. Algorithm 708: Significant 00028 Digit Computation of the Incomplete Beta Function Ratios. ACM 00029 Trans. Math. Softw. 18 (1993), 360-373. 00030 00031 ********************************************************************** 00032 ----------------------------------------------------------------------- 00033 EVALUATION OF LN(GAMMA(A)) FOR POSITIVE A 00034 ----------------------------------------------------------------------- 00035 WRITTEN BY ALFRED H. MORRIS 00036 NAVAL SURFACE WARFARE CENTER 00037 DAHLGREN, VIRGINIA 00038 -------------------------- 00039 D = 0.5*(LN(2*PI) - 1) 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 .. Executable Statements .. 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; } /* END */ |