REM   The infamous Savage benchmark

REM

REM   This is a test of floating-point speed and accuracy.

 

 

REM   We don't have tangent or square root built-in, so we'll add a couple

REM   of functions to provide them.

 

FUNCTION TAN(arg AS FLOAT) AS FLOAT

      TAN = SIN(arg) / COS(arg)

END

 

 

FUNCTION SQRT(arg AS FLOAT) AS FLOAT

      SQRT = arg ^ 0.5

END

 

 

 

GLOBAL x AS INTEGER

GLOBAL y AS FLOAT

GLOBAL w AS INTEGER

GLOBAL z AS INTEGER

 

y = 1.0

 

 

REM   Set the time to 0

 

DPOKE(14, -32767)

DPOKE(39,0)

 

 

REM   Run the calculations

 

FOR x = 1 TO 2500

      y = TAN(ARCTAN(10.0^(LOG(SQRT(y*y)))))+1.0

NEXT x

 

REM   Grab the end time & print the results

 

z = DPEEK(14)

w = DPEEK(39)

 

PRINT "\013\010", w AND 255, " minutes", w/256, " seconds", z

PRINT "\013\010", y - 2500