home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 91 / af091a.adf / af91a3.lzx / prgs / BenchMarks / Ahl.b < prev    next >
Text File  |  2018-01-23  |  1KB  |  52 lines

  1. {*
  2. ** Ahl Benchmark. Taken from a Pascal program in MacTutor magazine, 
  3. ** December 1984 as reprinted in MacTech magazine, December 1994.
  4. **
  5. ** The values printed by the MacPascal program
  6. ** were:
  7. **
  8. **    Time in seconds = 19
  9. **    Accuracy = 0.000000000000005662
  10. **    Random = 1.16641700000e+6
  11. **
  12. ** The slow speed (when compared with ACE) can be accounted for by 
  13. ** the fact that MacPascal was an interpreter and that the ACE version 
  14. ** uses SINGLE rather EXTENDED precision floating point variables. The
  15. ** speed of an accelerated A1200 compared to the original Benchmark
  16. ** machine might also have something to do with it! :)
  17. *}
  18.  
  19. SINGLE a,r,s
  20. SHORTINT i,n
  21. SINGLE result1,result2
  22. SINGLE t1,t2
  23.  
  24. '..Main.
  25. t1 = TIMER
  26.  
  27. FOR n=1 TO 100
  28.   a = n
  29.   FOR i=1 TO 10
  30.     a = SQR(a)
  31.     r = r+RND
  32.   NEXT
  33.  
  34.   FOR i=1 TO 10
  35.     a = a*a
  36.     r = r+RND
  37.   NEXT
  38.   
  39.   s = s+a
  40. NEXT
  41.   
  42. result1 = ABS(1010 - s/5)
  43. result2 = ABS(1000 - r)
  44.  
  45. t2 = TIMER
  46.  
  47. PRINT "Time in seconds =";t2-t1
  48. PRINT "Accuracy =";result1
  49. PRINT "Random =";result2
  50.  
  51. END
  52.