add numerical recipes library
This commit is contained in:
13
lib/nr/k_and_r/recipes/factln.c
Normal file
13
lib/nr/k_and_r/recipes/factln.c
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
float factln(n)
|
||||
int n;
|
||||
{
|
||||
float gammln();
|
||||
void nrerror();
|
||||
static float a[101];
|
||||
|
||||
if (n < 0) nrerror("Negative factorial in routine factln");
|
||||
if (n <= 1) return 0.0;
|
||||
if (n <= 100) return a[n] ? a[n] : (a[n]=gammln(n+1.0));
|
||||
else return gammln(n+1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user