add numerical recipes library

This commit is contained in:
2025-09-12 18:55:25 +09:00
parent d4dff245bd
commit 2c75620ec9
1344 changed files with 63869 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#include <math.h>
float factrl(n)
int n;
{
float gammln();
void nrerror();
static int ntop=4;
static float a[33]={1.0,1.0,2.0,6.0,24.0};
int j;
if (n < 0) nrerror("Negative factorial in routine factrl");
if (n > 32) return exp(gammln(n+1.0));
while (ntop<n) {
j=ntop++;
a[ntop]=a[j]*ntop;
}
return a[n];
}