Creative Computing Benchmark: Difference between revisions

Content deleted Content added
updated link
m Code: {{sxhl|2=basic|1=<nowiki/>}}
Tag: nowiki added
Line 23:
==Code==
This is the original version from the November 1983 edition:{{sfn|Ahl|1983|p=259}}
{{sxhl|2=basic|1=<nowiki/>
 
1 ' Ahl's simple benchmark test
2 ' In Lines 30 and 40, some computers
3 ' may require RND(1) for correct results
10 PRINT "Accuracy Random"
20 FOR N=1 TO 100:A=N
30 FOR I=1 TO 10:A=SQR(A):R=R+RND(0):NEXT I
40 FOR I=1 TO 10:A=A^2:R=R+RND(0):NEXT I
50 S=S+A:NEXT N
60 PRINT ABS(1010-S/5);ABS(1000-R)
}}
 
The following is from later versions of the benchmark code, which reduced the number of compound statements on a line:{{sfn|Ahl|1984|p=7}}{{efn|Likely to reduce the line length below 40 characters for all lines. In the original version, line 30 is 43 characters long.}}
{{sxhl|2=basic|1=<nowiki/>
 
10 ' Ahl's Simple Benchmark
20 FOR N=1 TO 100: A=N
30 FOR I=1 TO 10
40 A=SQR(A): R=R+RND(1)
50 NEXT I
60 FOR I=1 TO 10
70 A=A^2: R=R+RND(1)
80 NEXT I
90 S=S+A: NEXT N
100 PRINT ABS(1010-S/5)
110 PRINT ABS(1000-R)
}}
 
==Notes==