home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR9
/
EUPHOR10.ZIP
/
SIEVE.PRO
< prev
next >
Wrap
Text File
|
1993-06-05
|
1KB
|
44 lines
| ---------------------------
| -- Byte Magazine's --
| -- Prime Sieve Benchmark --
| ---------------------------
|
|without type_check -- makes no difference
|
|constant ITERATIONS = 1 -- was 1000
|
|constant SIZE = 8191,
| ON = 1,
| OFF = 0
|
|sequence flags
|
|global procedure main()
| integer prime, start, count, still_prime
| atom x
|
1 | x = time()
1 | for iter = 1 to ITERATIONS do
1 | count = 0
1 | flags = repeat(ON, SIZE)
1 | for i = 1 to SIZE do
8191 | still_prime = flags[i]
8191 | if still_prime then
1899 | prime = i + i
1899 | prime = prime + 1
| -- printf(1, "%d ", prime)
1899 | start = prime + i
1899 | for k = start to SIZE by prime do
14999 | flags[k] = OFF
| end for
1899 | count = count + 1
| end if
| end for
| end for
1 | printf(1, "%d primes\n", count) -- should be 1899
1 | printf(1, "%d iterations in %.2f seconds\n", {ITERATIONS, time() - x})
|end procedure
|
1 |main()