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,25 @@
#include "nr.h"
DP NR::ran4(int &idum)
{
#if defined(vax) || defined(_vax_) || defined(__vax__) || defined(VAX)
static const unsigned long jflone = 0x00004080;
static const unsigned long jflmsk = 0xffff007f;
#else
static const unsigned long jflone = 0x3f800000;
static const unsigned long jflmsk = 0x007fffff;
#endif
unsigned long irword,itemp,lword;
static int idums = 0;
if (idum < 0) {
idums = -idum;
idum=1;
}
irword=idum;
lword=idums;
psdes(lword,irword);
itemp=jflone | (jflmsk & irword);
++idum;
return (*(float *)&itemp)-1.0;
}