mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
a7a1c7e971
This directory needs to be reorganized and some of the tests need changes to make them executable. Also comments would help... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2865 91177308-0d34-0410-b5e6-96231b3b80d8
42 lines
810 B
C
42 lines
810 B
C
/* For copyright information, see olden_v1.0/COPYRIGHT */
|
|
|
|
/**********************************************************
|
|
* poisson.c: handles math routines for health.c *
|
|
**********************************************************/
|
|
|
|
#include <stdio.h>
|
|
#include <math.h>
|
|
|
|
/* From health.h */
|
|
#define IA 16807
|
|
#define IM 2147483647
|
|
#define AM (1.0 / IM)
|
|
#define IQ 127773
|
|
#define IR 2836
|
|
#define MASK 123459876
|
|
|
|
float my_rand(long idum)
|
|
{
|
|
long k;
|
|
float answer;
|
|
|
|
idum ^= MASK;
|
|
k = idum / IQ;
|
|
idum = IA * (idum - k * IQ) - IR * k;
|
|
idum ^= MASK;
|
|
if (idum < 0)
|
|
idum += IM;
|
|
answer = AM * idum;
|
|
return answer;
|
|
}
|
|
|
|
int
|
|
main(int argc, char** argv)
|
|
{
|
|
printf("my_rand(%d) = %g\n", 2555540, my_rand(2555540));
|
|
printf("my_rand(%d) = %g\n", 2427763, my_rand(2427763));
|
|
return 0;
|
|
}
|
|
|
|
|