´CMANTISSABAS_MANTISSAC ’/MANTISSAFOR ãMANTISSAPAS„^MANTISSAPKG–ÇWSTONE ALG;ÇWSTONE C :-­WSTONE DOCg€  WSTONE FORç&bWSTONE PAS /N¨WSTONE PKG<-7WSTONE- BASiæŒWSTONE/ BASˆ"€’ÿSIG-M LIBKñÿÃÌqâqÃtB $% ? (Y/N): 100 ' Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 110 ' This program determines effective number of bits in mantissa 120 ' of floating point number. 130 I% = 0 140 X = 1! 150 I% = I% + 1 160 X = X / 2! 170 IF ((1! + X) - 1!) <> 0! GOTO 150 180 PRINT "Significant Bits: ",I% 190 END 200 ' Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 0!/* Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 */ #include "stdio.h" /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ main() /* Estimate Number of Significant Bits. */ { int i ; float x ; i = 0 ; x = 1.0 ; do { ++i ; x /= 2.0 ; } while (((1.0 + x) - 1.0) != 0.0) ; printf("\n Significant Bits: %d", i) ; } /* Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 */ Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 program mantissa C This program computes effective number of bits in mantissa C of floating point number. integer i real x i = 0 x = 1.0 10 continue i = i + 1 x = x / 2.0 if (((1.0 + x) - 1.0) .ne. 0.0 ) GOTO 10 write(3,1111) i 1111 format( 19H Significant Bits: , i2) stop end Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 { Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 } program mantissa ; { } { This program computes effective number of significant } { bits in mantissa of floating point numbers. } { } var i : integer ; x : real ; begin i := 0 ; x := 1.0 ; repeat x := x / 2.0 ; i := i + 1 ; until (1.0 + x) - 1.0 = 0.0 ; writeln('Significant Bits: ', i:2) end. { Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 } -- Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 -- This program computes effective number of significant -- bits in mantissa of floating point numbers. with sfloatio,sfloatop,util ; package body mantissa is use sfloatio,sfloatop,util ; i : integer ; x : float ; begin i := 0 ; x := 1.0 ; <> x := x/2.0 ; i := i + 1 ; if (1.0 + x) - 1.0 > 0.0 then goto school ; end if ; new_line ; put(" Significant Bits: ") ; put(i,2) ; end mantissa ; -- Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 begin real x1,x2,x3,x4,x,y,z,t,t1,t2; array e1[1:4]; integer i,j,k,l,n1,n2,n3,n4,n5,n6 ,n7,n8,n9,n10,n11; procedure pa(e); array e; begin integer j; j := 0; lab: e[1] := (e[1] + e[2] + e[3] - e[4]) * t; e[2] := (e[1] + e[2] - e[3] + e[4]) * t; e[3] := (e[1] - e[2] + e[3] + e[4]) * t; e[4] := (-e[1] + e[2] + e[3] + e[4])/t2; j := j + 1; if j < 6 then goto lab; end procedure pa; procedure p0; begin e1[j] := e1[k]; e1[k] := e1[l]; e1[l] := e1[j]; end procedure p0; procedure p3(x,y,z); value x,y; real x,y,z; begin x := t * (x + y); y := t * (x + y); z := (x + y)/t2; end procedure p3; procedure pout(n,j,k,x1,x2,x3,x4); value n,j,k,x1,x2,x3,x4; integer n,j,k; real x1,x2,x3,x4; begin outreal(1,n); outreal(1,j); outreal(1,k); outreal(1,x1); outreal(1,x2); outreal(1,x3); outreal(1,x4); end procedure pout; comment initialise constants; t := 0.499975; t1 := 0.50025; t2 := 2.0; comment read value i, controlling total weight: if i = 10 the total weight is one million Whetstone instructions; inreal(2,i); n1 := 0; n2 := 12 * i; n3 := 14 * i; n4 := 345 * i; n5 := 0; n6 := 210 * i; n7 := 32 * i; n8 := 899 * i; n9 := 616 * i; n10 := 0; n11 := 93 * i; comment module 1: simple identifiers; x1 := 1.0; x2 := x3 := x4 := -1.0; for i := 1 step 1 until n1 do begin x1 := (x1 + x2 + x3 - x4) * t; x2 := (x1 + x2 - x3 + x4) * t; x3 := (x1 - x2 + x3 + x4) * t; x4 := (-x1 + x2 + x3 + x4) * t; end module 1; pout(n1,n1,n1,x1,x2,x3,x4); comment module 2: array elements; e1[1] := 1.0 ; e1[2] := e1[3] := e1[4] := -1.0; for i := 1 step 1 until n2 do begin e1[1] := (e1[1] + e1[2] + e1[3] - e1[4]) * t; e1[2] := (e1[1] + e1[2] - e1[3] + e1[4]) * t; e1[3] := (e1[1] - e1[2] + e1[3] + e1[4]) * t; e1[4] := (-e1[1] + e1[2] + e1[3] + e1[4]) * t; end module 2; pout(n2,n3,n2,e1[1],e1[2],e1[3],e1[4]); comment module 3: array as parameter; for i := 1 step 1 until n3 do pa(e1); pout(n3,n2,n2,e1[1],e1[2],e1[3],e1[4]); comment module 4: conditional jumps; j := 1; for i := 1 step 1 until n4 do begin if i = 1 then j := 2 else j := 3; if j > 2 then j := 0 else j := 1; if j < 1 then j := 1 else j := 0; end module 4; pout(n4,j,j,x1,x2,x3,x4); comment module 5: omitted; comment module 6: integer arithmetic; j := 1; k := 2; l := 3; for i := 1 step 1 until n6 do begin j := j * (k - j) * (l - k); k := l * k - (l - j) * k; l := (l - k) * (k + j) ; e1[l - 1] := j + k + l; e1[k - 1] := j * k * l; end module 6; pout(n6,j,k,e1[1],e1[2],e1[3],e1[4]); comment module 7: trig. functions; x := y := 0.5; for i := 1 step 1 until n7 do begin x := t * arctan(t2 * sin(x) * cos(x)/ (cos(x + y) + cos(x - y) - 1.0)); y := t * arctan(t2 * sin(y) * sin(y)/ (cos(x + y) + cos(x - y) - 1.0)); end module 7; pout(n7,j,k,x,x,y,y); comment module 8: procedure calls; x := y := z := 1.0; for i := 1 step 1 until n8 do p3(x,y,z); port(n8,j,k,x,y,z,z); comment module 9: array references; j := 1; k := 2; l := 3; e1[1] := 1.0; e1[2] := 2.0; e1[3] := 3.0; for i := 1 step 1 until n9 do p0; pout(n9,j,k,e1[1],e1[2],e1[3],e1[4]); comment module 10: integer arithmetic; j := 2; k := 3; for i := 1 step 1 until n10 do begin j := j + k; k := j + k; j := k - j; k := k - j - j; end module 10; pout(n10,j,k,x1,x2,x3,x4); comment module 11: standard functions; x := 0.75; for i := 1 step 1 until n11 do x := sqrt(exp(ln(x) / t1)); pout(n11,j,k,x,x,x,x); end /* Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 */ #include "stdio.h" float x1,x2,x3,x4,x,y,z,t,t1,t2 ; float e1[4] ; int i,j,k,l,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11 ; /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ main() /* */ /* Program: */ /* */ /* WSTONE - Whetstone Performance Measurement. */ /* */ /* Version: Date: */ /* */ /* C 04/29/85 */ /* */ /* Description: */ /* */ /* This program is a literal translation of the */ /* ALGOL version presented by the reference. */ /* */ /* The calls to CPUTim return a floating point */ /* value for the time of day in seconds. The */ /* author's CP/M Z80 system includes a Compu- */ /* Time ComputerWatch (tm) accessed using the */ /* routine CPUTim. */ /* */ /* Reference: */ /* */ /* A Synthetic Benchmark */ /* H.J. Curnow and B.A. Wichmann */ /* The Computer Journal */ /* Volume 19, Number 1 */ /* pg. 43-49 */ /* */ /* Author: */ /* */ /* Adam T. Fritz */ /* 133 Main Street */ /* Afton, New York 13730 */ /* */ { float CPUTim() ; float dt,w ; int n ; /* initialise constants */ t = 0.499975 ; t1 = 0.50025 ; t2 = 2.0 ; printf(" Enter i value: " ) ; Š scanf("%d", &n) ; i = n ; /* record time of day */ dt = CPUTim() ; n1 = 0 ; n2 = 12 * i ; n3 = 14 * i ; n4 = 345 * i ; n5 = 0 ; n6 = 210 * i ; n7 = 32 * i ; n8 = 899 * i ; n9 = 616 * i ; n10 = 0 ; n11 = 93 * i ; /* module 1: simple identifiers */ x1 = 1.0 ; x2 = x3 = x4 = -1.0 ; for (i = 0; i < n1; i++ ) { x1 = (x1+x2+x3-x4) * t ; x2 = (x1+x2-x3+x4) * t ; x3 = (x1-x2+x3+x4) * t ; x4 = (-x1+x2+x3+x4) * t ; } /* module 2: array elements */ e1[0] = 1.0 ; e1[1] = e1[2] = e1[3] = -1.0 ; for ( i = 0; i < n2; i++ ) { e1[0] = (e1[0]+e1[1]+e1[2]-e1[3]) * t ; e1[1] = (e1[0]+e1[1]-e1[2]+e1[3]) * t ; e1[2] = (e1[0]-e1[1]+e1[2]+e1[3]) * t ; e1[3] = (-e1[0]+e1[1]+e1[2]+e1[3]) * t ; } /* module 3: array as parameter */ for ( i = 0; i < n3; i++ ) pa(e1) ; /* module 4: conditional jumps */ j = 1 ; for ( i = 0; i < n4; i++ ) { if (j == 1) j = 2 ; else j = 3 ; if (j > 2) j = 0 ; else j = 1 ; if (j < 1) j = 1 ; else j = 0 ; } /* module 5: omitted */ /* module 6: integer arithmetic */ j = 1 ; k = 2 ; l = 3 ; for ( i=0; i < n6; i++ ) { j = j * (k-j) * (l-k) ; k = l * k-(l-j) * k ; l = (l-k) * (k+j) ; e1[l-1] = j+k+l ; e1[k-1] = j * k * l ; } /* module 7: trig. functions */ x = y = 0.5 ; for ( i = 0; i < n7; i++ ) { x = t*atan2(t2*sin(x)*cos(x),(cos(x+y)+cos(x-y)-1.0)) ; y = t*atan2(t2*sin(y)*cos(y),(cos(x+y)+cos(x-y)-1.0)) ; } /* module 8: procedure calls */ x = y = z = 1.0 ; for ( i = 0; i < n8; i++ ) p3(x,y,&z) ; /* module 9: array references */ j = 1 ; k = 2 ; l = 3 ; e1[0] = 1.0 ; e1[1] = 2.0 ; e1[2] = 3.0 ; for ( i = 0; i < n9; i++ ) Š p0() ; /* module 10: integer arithmetic */ j = 2 ; k = 3 ; for ( i = 0; i < n10; i++ ) { j = j+k ; k = j+k ; j = k-j ; k = k-j-j ; } /* module 11: standard functions */ x = 0.75 ; for ( i = 0; i < n11; i++ ) x = sqrt(exp(log(x)/t1)) ; /* compute elapsed time */ dt = CPUTim() - dt ; /* compute Whetstone rating */ w = ( (float) n ) * 1.e5 / dt ; printf("\n Weight = %3d Elapsed time = %7.2f CPU Sec.", n, dt) ; printf("\n Speed = %8.2f Whetstones/sec.", w) ; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ pa ( e ) float e[] ; { int j ; j = 0 ; lab: e[0] = (e[0]+e[1]+e[2]-e[3]) * t ; e[1] = (e[0]+e[1]-e[2]+e[3]) * t ; e[2] = (e[0]-e[1]+e[2]+e[3]) * t ; e[3] = (-e[0]+e[1]+e[2]+e[3]) / t2 ; j = j+1 ; if( j < 6 ) goto lab ; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ p0 () { e1[j] = e1[k] ; e1[k] = e1[l] ; e1[l] = e1[j] ; } /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ p3 ( x,y,z ) float x,y,*z ; { x = t * (x + y) ; y = t * (x + y) ; *z = (x+y) / t2 ; } /* Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 */  WSTONE Version 1.2 April 29, 1985 Adam Fritz 133 Main Street Afton, New York 13730 Thió  reporô  presentó Whetstonå benchmarë  (Referencå  1© resultó  foò somå microcomputeò systemó witè referencå  tï  otheò publisheä results® (Referenceó 2¬ 3¬ and 4) Thå  Whetstonå  performancå  tesô compriseó  severaì  codå moduleó  eacè  performeä á numbeò oæ timeó determineä  bù  á useò supplieä 'I§ valuå anä prograí weightinç  parameters®  (Com menô  1© Thå loopó variouslù emphacizå integeò oò floatinç arith metic¬  simplå oò subscripteä variables¬  anä subprograí oò func tioî librarù routinå calls. Thå  ALGOÌ  versioî iî WSTONE.ALÇ ió takeî froí referencå  ± witè  onlù á missprinô iî modulå ¶ corrected®  Thå ALGOÌ  versioî includeó outpuô statementó useä tï verifù modulå execution® Otheò versionó  omiô  theså outpuô statements®  Thå FORTRAÎ versioî  iî WSTONE.FOÒ  ió adapteä froí Referencå ² witè somå  changeó  tï reordeò  declarativå statements¬  uså standarä I/Ï  statements¬ anä  computå performancå ratingó iî Whetstoneó ratheò thaî  kilo- Whetstones®  Thå PASCAL¬ BASIC¬ C¬ anä JANUS/Adá versionó arå iî WSTONE.PAS¬ WSTONE.BAS¬ WSTONE.C¬ anä WSTONE.PKÇ respectively. Timeó foò CP/Í (tm© runó arå measured¬ wheî possible¬ tï thå nearesô seconä bù readinç á ComputerWatcè (tm© clock/calen daò boarä - seå Commenô 2®  Thå MS-DOÓ (tm© timeó arå measureä usinç calló tï DOÓ datå anä timå functions®  Iî alì caseó  timinç ió checkeä usinç á handhelä stopwatch. Thå numberó reporteä foò mantissá arå deriveä usinç routineó MANTISSA.*®  Precisioî ió deriveä usinç onå lesó thaî thå numbeò oæ effectivå bitó iî thå mantissa. PERFORMANCE =========== The microcomputer based results are; processor op sys / compiler mantissa speed (1) --------- ----------------- -------- ----- SBC-200 4MHz Z-80 CP/M MS Basic 5.1 25 1905 (2) SBC-200 4MHz Z-80 CP/M MS Fortran 3.2 25 7273 Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 ŠSBC-200 4MHz Z-80 CP/M MS Fortran 3.2 57 848 SBC-200 4MHz Z-80 CP/M Nevada Fortran 2.2 25 1875 SBC-200 4MHz Z-80 CP/M TURBO Pascal 1.0 40 4310 SBC-200 4MHz Z-80 CP/M TURBO Pascal 2.0 40 4310 SBC-200 4MHz Z-80 CP/M TURBO Pascal 3.00A 40 4310 SBC-200 4MHz Z-80 CP/M Pascal/Z 3.2-1 23 1911 SBC-200 4MHz Z-80 CP/M Pascal/MT+ 5.2 24 4918 SBC-200 4MHz Z-80 CP/M JRT Pascal 3.0 44 400 SBC-200 4MHz Z-80 CP/M AZTEC C II 1.06b 57 629 SBC-200 4MHz Z-80 CP/M Eco-C 3.1 57 889 SBC-200 4MHz Z-80 CP/M JANUS/Ada 1.5.0 24 2597 SBC-200 4MHz Z-80 CP/M JANUS/Ada 1.5.0 56 1550 H/Z-100 8MHz 8088 MS-DOS Z-Basic 24 3226 (3) H/Z-100 8MHz 8088 MS-DOS Basic Compile 5.4 129 29412 (4) H/Z-100 8MHz 8088 MS-DOS MS Fortran 3.10 24 6380 H/Z-100 8MHz 8087 MS-DOS MS Fortran 3.10 24 118750 H/Z-100 8MHz 8088 MS-DOS MS Fortran 3.20 24 27778 H/Z-100 8MHz 8088 MS-DOS MS Fortran 3.20 53 lllll H/Z-100 8MHz 8087 MS-DOS MS Fortran 3.20 24 92000 H/Z-100 8MHz 8087 MS-DOS MS Fortran 3.20 53 71875 H/Z-100 8MHz 8088 MS-DOS MS Pascal 3.11 64 6980 H/Z-100 8MHz 8087 MS-DOS MS Pascal 3.11 64 152174 H/Z-100 8MHz 8088 MS-DOS TURBO Pascal 2.0 40 4477 H/Z-100 8MHz 8087 MS-DOS TURBO Pascal 2.0 53 61633 H/Z-100 8MHz 8088 MS-DOS TURBO Pascal 3.0 40 11718 H/Z-100 8MHz 8087 MS-DOS TURBO Pascal 3.0A 53 62657 H/Z-100 8MHz 8088 MS-DOS Eco-C 1.5 53 2920 H/Z-100 8MHz 8087 MS-DOS Eco-C 1.5 53 40345 CO16 6MHz 8086 MS-DOS MS Fortran 3.20 24 25210 (5) CO16 8MHz 8086 MS-DOS MS Fortran 3.20 24 32258 CO16 6MHz 8087 MS-DOS MS Fortran 3.20 64 78950 CO16 8MHz 8087 MS-DOS MS Fortran 3.20 64 105882 CO16 6MHz 8087 MS-DOS MS Pascal 3.11 64 111110 CO16 8MHz 8087 MS-DOS MS Pascal 3.11 64 156522 CO16 6MHz 8086 MS-DOS TURBO Pascal 2.0B 40 3140 CO16 8MHz 8086 MS-DOS TURBO Pascal 2.0B 40 4186 CO16 6MHz 8087 MS-DOS TURBO Pascal 2.0B 53 44520 CO16 8MHz 8087 MS-DOS TURBO Pascal 2.0B 53 62344 CO16 6MHz 8086 MS-DOS TURBO Pascal 3.00B 40 11330 CO16 8MHz 8086 MS-DOS TURBO Pascal 3.00B 40 15207 CO16 8MHz 8086 MS-DOS TURBO Pascal 3.01A 40 15225 CO16 6MHz 8087 MS-DOS TURBO Pascal 3.01A 53 51550 CO16 8MHz 8087 MS-DOS TURBO Pascal 3.01A 53 72046 CO16 8MHz 8086 MS-DOS Eco-C 1.5 53 3330 (6) CO16 6MHz 8087 MS-DOS Eco-C 1.5 53 31910 CO16 8MHz 8087 MS-DOS Eco-C 1.5 53 48379 PC 4.77MHz 8088 PC-DOS BASICA 2.10 24 1740 (7) PC 4.77MHz 8088 PC-DOS MS Fortran 3.2 24 16670 PC 4.77MHz 8088 PC-DOS MS Fortran 3.1 24 3880 Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 ŠPC 4.77MHz 8088 PC-DOS MS Pascal 3.11 64 4240 PC 4.77MHz 8088 PC-DOS TURBO Pascal 3.0 40 6980 PC 4.77MHz 8088 PC-DOS Eco-C 1.5 53 1800 Reference 2 presents the following table; processor op sys / compiler precision speed (8) --------- ----------------- --------- ----- PDP-8i OS/8 Fortran IV 2^23 2.6 PDP-8e OS/8 Fortran IV 2^23 3.15 PDP-12,FPP ? 2^23 34.5 PDP-11/45,FPP RT11 Fortran IV 2^55 65.96 PDP-11/45,FPP Fortran-IV-Plus 2^55 168.86 PDP-11/70,FPP RSTS/E Basic-Plus 2^23 35.52 PDP-11/70,FPP RSTS/E Basic-Plus (%) 2^23 44.99 PDP-11/70,FPP RSTS/E Basic-Plus-2 2^23 l71.23 PDP-11/70,FPP RSTS/E Fortran-IV V1 2^23 216.76 PDP-11/70,FPP RSTS/E Fortran-IV V2 2^23 285.63 PDP-11/70,FPP RSTS/E Fortran-IV-Plus 2^23 631.96 PDP-11/70,FPP RSTS/E Fortran-IV-Plus 2^55 479.04 VAX 11/780 VMS Fortran-IV-Plus 2^23 711 VAX 11/780,FPA VMS Fortran-IV-Plus 2^23 1200 IBM 360/65 Fortran G 16^6 430 IBM 360/65 Fortran G 16^14 321 IBM 360/65 Fortran H OPT 2 16^6 521 IBM 360/65 Fortran H OPT 2 16^14 421 IBM 360/75 Fortran G ? 518.6 IBM 360/158 VSII V1.7 HASP 16^6 650 Fortran H EXT LEV 2.1 No Optimize DECSYSTEM 10 KA Fortran 2^27 194 DECSYSTEM 10 KA Fortran 2^54 56 DECSYSTEM 10 KI Fortran 2^27 500 DECSYSTEM 10 KI Fortran 2^54 250 NOVA 840 Fortran 2^27 71 NOVA 840 Fortran 2^54 56 CDC 6500 MACE Fortran OPT 2 2^48 610.17 CDC 6500 MACE Zurich Pascal 2^48 473.38 CDC 7600 Fortran OPT 2 2^48 8333.0 Thå  followinç  datá ió excerpteä froí Tableó 2.â  anä  unlabeleä tablå oî pagå 2¹ oæ Referencå 3; Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 Šprocessor op sys / compiler precision speed (1) --------- ----------------- --------- ----- CRDS 12.5MHz 68000 UNOS 67000 CRDS 12.5MHz SKYMNK UNOS 285000 8MHz 68000 UNIX V7 SVS F77 23500 8MHz SKYFFP UNIX V7 SVS F77 Threaded 76900 CRDS 12.5MHz 68000 UNOS 3.0 SVS F77 69450 CRDS 12.5MHZ SKYFFP UNOS 3.0 SVS F77 Threaded 294100 Thå followinç datá ió excerpteä froí Referencå 4¬ Tablå 5; processor op sys / compiler precision speed (1) --------- ----------------- --------- ----- PC 4.7MHz 8087 PC-DOS DRI F77 67000 PC 4.7MHz 8087 PC-DOS MS F77 62500 Z100 4.7MHz 8088 Z-DOS SuperSoft F66 13158 Z100 4.7MHz 8088 Z-DOS MS F77 4082 Z100 4.7MHz 8088 Z-DOS DRI F77 1090 NOTES ===== (1) Speed measured in Whetstones/Second. (2) SBC-200 (tm) CP/M Version 2.2 (3) H/Z-100 (tm) MS-DOS Version 2.18 (4) Thå  anomalouó precisioî resultó froí compileò foldinç  oæ        MANTISSA's test expression;         ((1.0 + x) - 1.0) <> 0.0 (5) CO16 (tm) MS-DOS Version 2.11 (6) CO1¶  8MHú  versionó achieveä bù upgradinç 1µ MHú  crystaì        tï 2° MHú anä changinç interrupô countó iî MSBIOÓ  routinå        TIMER. (7) PC (tm) PC-DOS 1.0 (8) Speed measured in kilo Whetstones/Second. COMMENTS ======== 1. Thå  É  valuå ió largelù arbitrary®  Satisfactorù  resultó       foò  microó  withouô arithmetiã processoró caî bå  achieveä       usinç  ± oò ² foò É valueó anä 1° oò 2° witè  coprocessors®       Foò machineó anä languageó witè 1¶ biô integeró thå largesô       É valuå beforå overflo÷ ió 36. Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 Š 2. Foò singlå useò machineó withouô multiprocessinç thå timå       oæ daù anä elapseä cpõ timå arå similar® Iæ Whetstonå ió       ruî iî á shareä prograí counteò environmenô theî CPUTií       musô record elapseä cpõ time. 3. MÓ Fortraî anä BASIà offeò á choicå oæ singlå precisoî oò       doublå precisioî witè thå restrictioî iî BASIà thaô trans       cendentaló  arå  computeä singlå  precision®  TURBÏ  Pascaì       offeró  somethinç betweeî singlå anä doublå precisioî witè       doublå precisioî onlù iî 808· versions® Eco-à offeró doublå       oò nothing® 4. MÓ Fortraî anä BASIà operandó requirå ´ oò ¸ bytes® TURBÏ       Pascaì requireó ¶ oò ¸ dependinç oî implementation® Eco-à       requireó ¸ bytes®    5. Wherå resultó foò twï precisionó appeaò differenô  declara       tionó anä librarù calló werå used. OBSERVATIONS ============    1. Therå  ió  nï correlatioî betweeî compilå timå anä  runtimå       performance.    2. Therå  ió  onlù  silghô correlatioî betweeî  compilå  time¬       runtime¬ anä accuracy® Notå anomalouó JANUS/Adá long-float. CONCLUSIONS =========== 1. Runtimå   floatinç  poinô  performancå  ió  á   complicateä       functioî  oæ  processor¬  numeriã  processor¬  clocë  rate¬       language¬ compileò version¬ variablå precision¬ anä librarù       version®    2. Aô comparablå clocë rateó aî 808¸ ió twicå oò morå aó  fasô       aó á Z-80¬ anä aî 808¶ ió abouô 30¥ fasteò thaî aî 8088.    3. Otheò  thingó beinç equal¬  á numeriã processoò caî makå  á       ten to one or better runtime performance difference.    4. Aô comparablå clocë rateó witè 808· numeriã processoró  thå       8088/808¶  processoò throughpuô differencå ió noô importanô       becauså numeriã processoò performancå dominateó.    5. Resultó  witè  numeriã processoò scalå linearlù witè  clocë       rate¬ anä resultó witè numeriã processoò scalå linearlù buô       wuth a much steeper slope. Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 Š    6. Foò intenså numericaì codå thå 100-30° tï ± ratiï oæ inter       pretivå  tï  compileä languagå performancå ió dominateä  bù       floating point computation time.    7. Onlù thå BASIà anä AZTEà à IÉ compileró detecteä thå simplå       constanô foldinç optimizatioî opportunitù iî MANTISSA®  Thå       resulô witè á reviseä foldinç criterion;        (1.0 + x) <> 1.0       is 24 significant bits for BASIC and as specified for C II.    8. Differenô  precisionó  appeaò foò differenô  808·  versionó       becauså differenô numeriã processoò modeó arå beinç useä bù       different software. 9. Foò singlå precisioî numericallù intensivå productioî code¬       MÓ Fortran rankó highesô foò CP/Í baseä systems® TURBÏ       Pascaì tradeó precisioî foò runtimå performance® Eco-à       offeró competitivå performancå aô doublå precision®  Foò       MS-DOÓ  environmentó MÓ Pascaì offeró superioò  performancå       witè  coprocessoò  configurationó aô thå  expenså  oæ  non-       numeriã processoò configurations®  Compilå Basiã waó fast       esô  withouô  coprocessor®  MÓ  Pascaì waó  noô  ruî  witè       'short' real option.   10. Á  neweò compileò versioî maù noô offeò betteò performance¬       particularlù iæ performancå foò coprocessoò  configurationó       ió enhanceä aô thå expenså oæ threadeä codå versions® REFERENCE ========= 1. A Synthetic Benchmark H.J. Curnow and B.A. Wichmann The Computer Journal Volume 19, Number 1 1976 2. WHET.FOR DECUS 1981 Spring Tape Anonymous Some of the Whetstone ratings are reported to be extracted from; DECUS 12-Bit SIG Newsletter October 1975 Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 Š 3. Performance Comparison: Enhanced Supermicro and the VAX/780 Joe Germann Unix/World January/February 1984 pg. 26-31 4. A Critical Look at the 8088 Rick Lutowski Sextant Issue 16, May-June 1985 pg. 75-98 5. Z80 Assembly Language Programming Lance A. Leventhal Osborne & Associates, Inc. 1979 DISTRIBUTION ============ WSTONE.DOC This document. WSTONE.ALG Originaì  Whetstonå  prograí froí referencå ±  witè  missprinô    correcteä iî Modulå 6;     Reads: l := (l - k * ) (k + j) ;     Corrected: l := (l - k) * (k + j) ; WSTONE/.BAS - CP/M WSTONE-.BAS - MS-DOS MANTISSA.BAS - CP/M and MS-DOS BASIà versionó foò CP/Í anä MS:DOS¬  respectively® Differencå    is in computation of time of day. WSTONE.FOR - CP/M and MS-DOS MANTISSA.FOR - CP/M and MS-DOS Microsofô FORTRAÎ versionó witè supportinç routines® Doublå    precisioî versionó deriveä bù changinç REAÌ declarationó tï    DOUBLÅ PRECISIOÎ anä usinç appropriatå doublå precisioî    librarù functions¬ e.g® DSIN¬ etc. Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 Š WSTONE.C - CP/M and MS-DOS MANTISSA.C - CP/M and MS-DOS Ecosofô  Eco-à routineó. WSTONE.PAS - CP/M and MS-DOS MANTISSA.PAS - CP/M and MS-DOS TURBÏ  Pascaì routineó. WSTONE.PKG - CP/M MANTISSA.PKG - CP/M    JANUS/Ada version without clock/calendar facility. NOTICES ======= CO16 (tm) Hallock Systems Company CRDS (tm) Charles River Data Systems ComputerWatch (tm) CompuTime H/Z-100, Z100 (tm) Zenith Data Systems PC (tm) International Business Machine SBC-200 (tm) SD Systems SKYFFP, SKYMNK (tm) Sky Computer CP/M (tm) Digital Research MS-DOS (tm) Microsoft PC-DOS (tm) International Business Machine UNIX (tm) AT&T Information Systems UNOS (C) Charles River Data Systems Z-DOS (C) Zenith Data Systems AZTEC C II (C) Manx Software Systems BASICA (C) ... DRI F77 (C) Digital Research Eco-C (C) Ecosoft JANUS/Ada (C) RR Software JRT Pascal (C) JRT Systems MS Basic, MS Fortran, MS F77, MS Pascal (C) Microsoft Nevada Fortran (C) Ian Kettleborough Pascal/MT+ (C) Digital Research Pascal/Z (C) Jeff Moskow SVS Fortran77 (C) ... TURBO Pascal (tm) Borland International Z80ASM (tm) SLR Systems Z-Basic (tm) Microsoft Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 ŠCopyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 program wstone C Program: C C WSTONE - Whetstone Performance Measurement. C C Version: Date: C C Fortran 04/29/85 C C Description: C C This program is a literal translation of the C ALGOL version presented by the reference. C C Reference: C C A Synthetic Benchmark C H.J. Curnow and B.A. Wichmann C The Computer Journal C Volume 19, Number 1 C pg. 43-49 C C Author: C C Adam T. Fritz C 133 Main Street C Afton, New York 13730 real x1,x2,x3,x4,x,y,z,t,t1,t2 real dt,w dimension e1(4) integer i,j,k,l,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11 integer n common t,t1,t2,e1,j,k,l C Initialise Constants t=0.499975 t1=0.50025 t2=2.0 write(3,400) 400 format ( / ' Enter I value: ' ) read(3,410) n 410 format ( i2 ) C Record time of day i = n dt = CPUTim ( x ) n1=0 n2=12*i n3=14*i Š n4=345*i n5=0 n6=210*i n7=32*i n8=899*i n9=616*i n10=0 n11=93*i C Module 1: Simple Identifiers x1=1.0 x2=-1.0 x3=-1.0 x4=-1.0 do 18 i=1,n1,1 x1=(x1+x2+x3-x4)*t x2=(x1+x2-x3+x4)*t x4=(-x1+x2+x3+x4)*t x3=(x1-x2+x3+x4)*t 18 continue C Module 2: Array Elements e1(1)=1.0 e1(2)=-1.0 e1(3)=-1.0 e1(4)=-1.0 do 28 i=1,n2,1 e1(1)=(e1(1)+e1(2)+e1(3)-e1(4))*t e1(2)=(e1(1)+e1(2)-e1(3)+e1(4))*t e1(3)=(e1(1)-e1(2)+e1(3)+e1(4))*t e1(4)=(-e1(1)+e1(2)+e1(3)+e1(4))*t 28 continue C Module 3: Array as Parameter do 38 i=1,n3,1 38 call pa(e1) C Module 4: Conditional Jumps j=1 do 48 i=1,n4,1 if (j-1) 43,42,43 42 j=2 goto 44 43 j=3 44 if (j-2) 46,46,45 45 j=0 goto 47 46 j=1 47 if (j-1) 411,412,412 411 j=1 goto 48 Š412 j=0 48 continue C Module 5: Omitted C Module 6: Integer Arithmetic j=1 k=2 l=3 do 68 i=1,n6,1 j=j*(k-j)*(l-k) k=l*k-(l-j)*k l=(l-k)*(k+j) e1(l-1)=j+k+l e1(k-1)=j*k*l 68 continue C Module 7: Trig. Functions x=0.5 y=0.5 do 78 i=1,n7,1 x=t*atan(t2*sin(x)*cos(x)/(cos(x+y)+cos(x-y)-1.0)) y=t*atan(t2*sin(y)*cos(y)/(cos(x+y)+cos(x-y)-1.0)) 78 continue C Module 8: Procedure Calls x=1.0 y=1.0 z=1.0 do 88 i=1,n8,1 88 call p3(x,y,z) C Module 9: Array References j=1 k=2 l=3 e1(1)=1.0 e1(2)=2.0 e1(3)=3.0 do 98 i=1,n9,1 98 call p0 C Module 10: Integer Arithmetic j=2 k=3 do 108 i=1,n10,1 j=j+k k=j+k j=k-j k=k-j-j 108 continue Š C Module 11: Standard Functions x=0.75 do 118 i=1,n11,1 118 x=sqrt(exp(alog(x)/t1)) C Compute elapsed time dt = CPUTim(x) - dt C Compute Whetstone Rating w = float ( n ) * 1.e5 / dt write(3,920) n, dt 920 format ( // 10h Weight = , i3, 16h Elapsed time = , f7.2, 9h CPU sec. / * 8h Speed =, f8.2, 16h Whetstones/Sec. / ) stop end subroutine pa(e) real e,t,t1,t2 dimension e(4) common t,t1,t2 j=0 1 e(1)=(e(1)+e(2)+e(3)-e(4))*t e(2)=(e(1)+e(2)-e(3)+e(4))*t e(3)=(e(1)-e(2)+e(3)+e(4))*t e(4)=(-e(1)+e(2)+e(3)+e(4))/t2 j=j+1 if (j-6) 1,2,2 2 continue return end subroutine p0 real t,t1,t2,e1 common t,t1,t2,e1(4),j,k,l e1(j)=e1(k) e1(k)=e1(l) e1(l)=e1(j) return end subroutine p3(x,y,z) real x,y,z,t,t1,t2,x1,y1 common t,t1,t2 x1=x y1=y x1=t*(x1+y1) y1=t*(x1+y1) z=(x1+y1)/t2 return end Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 { Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 } program Whetstone ; { } { Program: } { } { WSTONE - Whetstone Performance Measurement. } { } { Version: Date: } { } { Pascal 04/29/85 } { } { Description: } { } { This program is a literal translation of the } { ALGOL version presented by the reference. } { } { Reference: } { } { A Synthetic Benchmark } { H.J. Curnow and B.A. Wichmann } { The Computer Journal } { Volume 19, Number 1 } { pg. 43-49 } { } { Author: } { } { Adam T. Fritz } { 133 Main Street } { Afton, New York 13730 } { } type vector = array[1..4] of real ; var x1,x2,x3,x4,x,y,z,t,t1,t2 : real ; e1 : vector ; i,j,k,l,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11 : integer ; dt,w : real ; n : integer ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} {$I CPUTim/.pas TOD Seconds } {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure pa ( var e : vector ) ; label lab ; var j : integer ; begin j := 0 ; lab: e[1] := (e[1]+e[2]+e[3]-e[4]) * t ; e[2] := (e[1]+e[2]-e[3]+e[4]) * t ; e[3] := (e[1]-e[2]+e[3]+e[4]) * t ; e[4] := (-e[1]+e[2]+e[3]+e[4]) / t2 ; j := j+1 ; if j < 6 then goto lab end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure p0 ; begin e1[j] := e1[k] ; e1[k] := e1[l] ; e1[l] := e1[j] end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure p3 ( x,y : real ; var z : real ) ; begin x := t * (x + y) ; y := t * (x + y) ; z := (x+y)/t2 end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} begin { initialize constants } t := 0.499975 ; t1 := 0.50025 ; t2 := 2.0 ; { read value of i, controlling total } { weight: if i = 10 the total weight } { is one million Whetstone instructions } write('Enter i value: ') ; readln(n) ; { record time of day } dt := CPUTim ; i := n ; n1 := 0 ; n2 := 12 * i ; n3 := 14 * i ; n4 := 345 * i ; n5 := 0 ; n6 := 210 * i ; n7 := 32 * i ; n8 := 899 * i ; n9 := 616 * i ; n10 := 0 ; n11 := 93 * i ; { module 1: simple identifiers } x1 := 1.0 ; x2 := -1.0 ; x3 := -1.0 ; x4 := -1.0 ; for i := 1 to n1 do begin x1 := (x1+x2+x3-x4) * t ; x2 := (x1+x2-x3+x4) * t ; x3 := (x1-x2+x3+x4) * t ; x4 := (-x1+x2+x3+x4) * t end ; { module 2: array elements } e1[1] := 1.0 ; e1[2] := -1.0 ; e1[3] := -1.0 ; e1[4] := -1.0 ; for i := 1 to n2 do begin e1[1] := (e1[1]+e1[2]+e1[3]-e1[4]) * t ; e1[2] := (e1[1]+e1[2]-e1[3]+e1[4]) * t ; e1[3] := (e1[1]-e1[2]+e1[3]+e1[4]) * t ; e1[4] := (-e1[1]+e1[2]+e1[3]+e1[4]) * t end ; { module 3: array as parameter } for i := 1 to n3 do pa(e1) ; { module 4: conditional jumps } j := 1 ; for i := 1 to n4 do begin if j = 1 then j := 2 else j := 3 ; if j > 2 then j := 0 else j := 1 ; if j < 1 then j := 1 else j := 0 end ; { module 5: omitted } { module 6: integer arithmetic } j := 1 ; k := 2 ; l := 3 ; for i := 1 to n6 do begin j := j * (k-j) * (l-k) ; k := l * k-(l-j) * k ; l := (l-k) * (k+j) ; e1[l-1] := j+k+l ; e1[k-1] := j * k * l end ; { module 7: trig. functions } x := 0.5 ; y := 0.5 ; for i := 1 to n7 do begin x := t*arctan(t2*sin(x)*cos(x)/(cos(x+y)+cos(x-y)-1.0)) ; y := t*arctan(t2*sin(y)*cos(y)/(cos(x+y)+cos(x-y)-1.0)) end ; { module 8: procedure calls } x := 1.0 ; y := 1.0 ; z := 1.0 ; for i := 1 to n8 do p3(x,y,z) ; { module 9: array references } j := 1 ; k := 2 ; l := 3 ; e1[1] := 1.0 ; e1[2] := 2.0 ; e1[3] := 3.0 ; for i := 1 to n9 do p0 ; { module 10: integer arithmetic } j := 2 ; k := 3 ; for i := 1 to n10 do begin j := j+k ; k := j+k ; j := k-j ; k := k-j-j end ; { module 11: standard functions } x := 0.75 ; for i := 1 to n11 do x := sqrt(exp(ln(x)/t1)) ; { compute elapsed time } dt := CPUTim - dt ; { compute performance } w := ( n ) * 1.e5 / dt ; writeln ; writeln(' Weight = ', n:3,' Elapsed time = ', dt:7:2, ' CPU Sec.') ; writeln ; writeln(' Speed = ', w:8:2, ' Whetstones/sec.') ; end. { Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 } -- Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 pragma rangecheck(off); pragma debug(off) ; pragma arithcheck(off) ; with sfloatio,sfloatop,smathlib,util ; Package Body WSTONE Is use sfloatio,sfloatop,smathlib,util ; -- Program: -- -- WSTONE - Whetstone Performance Measurement. -- -- Version: Date: -- -- 1.0 JANUS/Ada 1.5.0 04/29/85 -- -- Description: -- -- This program is a literal translation of the -- ALGOL version presented by the reference. -- -- Reference: -- -- A Synthetic Benchmark -- H.J. Curnow and B.A. Wichmann -- The Computer Journal -- Volume 19, Number 1 -- pg. 43-49 -- -- Author: -- -- Adam T. Fritz -- 133 Main Street -- Afton, New York 13730 type vector is array(1..4) of float ; x1,x2,x3,x4,x,y,z,t,t1,t2 : float ; e1 : vector ; i,j,k,l,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12 : integer ; dt,w : float ; n : integer ; --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ procedure pa ( e : in out vector ) is j : integer ; begin j := 0 ; Š <> e(1) := (e(1)+e(2)+e(3)-e(4)) * t ; e(2) := (e(1)+e(2)-e(3)+e(4)) * t ; e(3) := (e(1)-e(2)+e(3)+e(4)) * t ; e(4) := (-e(1)+e(2)+e(3)+e(4)) * t ; j := j+1 ; if j < 6 then goto lab; end if ; end pa ; --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ procedure p0 is begin e1(j) := e1(k) ; e1(k) := e1(l) ; e1(l) := e1(j) ; end p0 ; --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ procedure p3 ( x,y : in float ; z : out float ) is x1,y1 : float ; begin x1 := x ; y1 := y ; x1 := t * (x1 + y1) ; y1 := t * (x1 + y1) ; z := (x1+y1)/t2 ; end p3 ; --~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ begin -- Initialise constants t := 0.499975 ; t1 := 0.50025 ; t2 := 2.0 ; put(" Enter I value: " ) ; get(n) ; i := n ; -- Record time of day -- dt := CPUTim(0) ; n1 := 0 ; n2 := 12 * i ; Š n3 := 14 * i ; n4 := 345 * i ; n5 := 0 ; n6 := 210 * i ; n7 := 32 * i ; n8 := 899 * i ; n9 := 616 * i ; n10 := 0 ; n11 := 93 * i ; -- Module 1: Simple Identifiers x1 := 1.0 ; x2 := -1.0 ; x3 := -1.0 ; x4 := -1.0 ; for i in 1..n1 loop x1 := (x1+x2+x3-x4) * t ; x2 := (x1+x2-x3+x4) * t ; x3 := (x1-x2+x3+x4) * t ; x4 := (-x1+x2+x3+x4) * t ; end loop ; -- Module 2: Array Elements e1(1) := 1.0 ; e1(2) := -1.0 ; e1(3) := -1.0 ; e1(4) := -1.0 ; for i in 1..n2 loop e1(1) := (e1(1)+e1(2)+e1(3)-e1(4)) * t ; e1(2) := (e1(1)+e1(2)-e1(3)+e1(4)) * t ; e1(3) := (e1(1)-e1(2)+e1(3)+e1(4)) * t ; e1(4) := (-e1(1)+e1(2)+e1(3)+e1(4)) * t ; end loop ; -- Module 3: Array as Parameter for i in 1..n3 loop pa(e1) ; end loop ; -- Module 4: Conditional Jumps j := 1 ; for i in 1..n4 loop if j = 1 then j := 2 ; else j := 3 ; end if ; if j > 2 then Š j := 0 ; else j := 1 ; end if ; if j < 1 then j := 1 ; else j := 0 ; end if ; end loop ; -- Module 5: Omitted -- Module 6: Integer Arithmetic j := 1 ; k := 2 ; l := 3 ; for i in 1..n6 loop j := j * (k-j) * (l-k) ; k := l * k-(l-j) * k ; l := (l-k) * (k+j) ; e1(l-1) := float(j+k+l) ; e1(k-1) := float(j * k * l) ; end loop ; -- Module 7: Trig. Functions x := 0.5 ; y := 0.5 ; for i in 1..n7 loop x := t*arctan(t2*sin(x)*cos(x)/(cos(x+y)+cos(x-y)-1.0)) ; y := t*arctan(t2*sin(y)*cos(y)/(cos(x+y)+cos(x-y)-1.0)) ; end loop ; -- Module 8: Procedure Calls x := 1.0 ; y := 1.0 ; z := 1.0 ; for i in 1..n8 loop p3(x,y,z) ; end loop ; -- Module 9: Array References j := 1 ; k := 2 ; l := 3 ; e1(1) := 1.0 ; e1(2) := 2.0 ; e1(3) := 3.0 ; for i in 1..n9 loop Š p0 ; end loop ; -- Module 10: Integer Arithmetic j := 2 ; k := 3 ; for i in 1..n10 loop j := j+k ; k := j+k ; j := k-j ; k := k-j-j ; end loop ; -- Module 11: Standard Functions x := 0.75 ; for i in 1..n11 loop x := sqrt(exp(log(x)/t1)) ; end loop ; -- Compute elapsed time -- dt := CPUTim(0) - dt ; -- Compute Whetstone rating -- w := float(n) * 1.e5 / dt ; New_line ; put(" Weight = "); put(n,3); put(" Elapsed time = "); sfloatio.put(dt,4,2,0); put(" CPU Sec."); New_line ; put(" Speed = "); sfloatio.put(w,5,2,0); put(" Whetstones/Sec."); New_line ; end WSTONE ; -- Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 10 ' Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 20 ' Whetstone Benchmark (BASIC) - Single Precision 40 T = .499975 50 T1 = .50025 60 T2 = 2! 90 INPUT " ENTER I VALUE: "; N% 100 I% = N% 105 ' Record Time of Day 130 GOSUB 1410 140 DT = CPUTIM 160 N1% = 0 170 N2% = 12 * I% 180 N3% = 14 * I% 190 N4% = 345 * I% 200 N5% = 0 210 N6% = 210 * I% 220 N7% = 32 * I% 230 N8% = 899 * I% 240 N9% = 616 * I% 250 N10% = 0 260 N11% = 93 * I% 265 ' Module 1: Simple Identifiers 280 X1 = 1! 290 X2 = -1! 300 X3 = -1! 310 X4 = -1! 330 FOR I% = 1 TO N1% 340 X1 = (X1+X2+X3-X4) * T 350 X2 = (X1+X2-X3+X4) * T 360 X4 = (-X1+X2+X3+X4) * T 370 X3 = (X1-X2+X3+X4) * T 380 NEXT I% 385 ' Module 2: Array Elements 390 E1(1) = 1! 400 E1(2) = -1! 410 E1(3) = -1! 420 E1(4) = -1! 440 FOR I% = 1 TO N2% 450 E1(1) = (E1(1)+E1(2)+E1(3)-E1(4)) * T 460 E1(2) = (E1(1)+E1(2)-E1(3)+E1(4)) * T 470 E1(3) = (E1(1)-E1(2)+E1(3)+E1(4)) * T 480 E1(4) = (-E1(1)+E1(2)+E1(3)+E1(4)) * T 490 NEXT I% 495 ' Module 3: Array as Parameter 510 FOR I% = 1 TO N3% 520 GOSUB 1180 530 NEXT I% 535 ' Module 4: Conditional Jumps 540 J% = 1 560 FOR I% = 1 TO N4 570 IF (J% = 1) THEN J% = 2 ELSE J% = 3 580 IF (J% > 2) THEN J% = 0 ELSE J% = 1 590 IF (J% < 1) THEN J% = 1 ELSE J% = 0 600 NEXT I% 605 ' Module 5: Omitted 606 ' Module 6: Integer Arithmetic 610 J% = 1 620 K% = 2 630 L% = 3 650 FOR I% = 1 TO N6% 660 J% = J% * (K%-J%) * (L%-K%) 670 K% = L% * K%-(L%-J%) * K% 680 L% = (L%-K%) * (K%+J%) 690 E1(L%-1) = J% + K% + L% 700 E1(K%-1) = J% * K% * L% 710 NEXT I% 715 ' Module 7: Trig. Functions 720 X = .5 730 Y = .5 750 FOR I% = 1 TO N7% 760 X = T*ATN(T2*SIN(X)*COS(X)/(COS(X+Y)+COS(X-Y)-1!)) 770 Y = T*ATN(T2*SIN(Y)*COS(Y)/(COS(X+Y)+COS(X-Y)-1!)) 780 NEXT I% 785 ' Module 8: Procedure Calls 790 X = 1! 800 Y = 1! 810 Z = 1! 830 FOR I% = 1 TO N8% 840 GOSUB 1320 850 NEXT I% 855 ' Module 9: Array References 860 J% = 1 870 K% = 2 880 L% = 3 890 E1(1) = 1! 900 E1(2) = 2! 910 E1(3) = 3! 930 FOR I% = 1 TO N9% 940 GOSUB 1270 950 NEXT I% 955 ' Module 10: Integer Arithmetic 960 J% = 2 970 K% = 3 990 FOR I% = 1 TO N10% 1000 J% = J%+K% 1010 K% = J%+K% 1020 J% = K%-J% 1030 K% = K%-J%-J% 1040 NEXT I% 1045 ' Module 11: Standard Functions 1050 X = .75 1070 FOR I% = 1 TO N11% 1080 X = SQR(EXP(LOG(X)/T1)) 1090 NEXT I% 1095 ' Compute Elapsed Time 1100 GOSUB 1410 1110 DT = CPUTIM - DT 1120 ' Compute Whetstone Rating 1130 W = ( N% ) * 1.E5 / DT 1140 PRINT " Weight = ", N%, " Elapsed time = ", DT, " CPU Sec." 1160 PRINT " Speed = ", W, " Whetstones/Sec." 1170 END 1180 REM SUBROUTINE PA(E) 1190 J% = 0 1200 E1(1) = (E1(1)+E1(2)+E1(3)-E1(4)) * T 1210 E1(2) = (E1(1)+E1(2)-E1(3)+E1(4)) * T 1220 E1(3) = (E1(1)-E1(2)+E1(3)+E1(4)) * T 1230 E1(4) = (-E1(1)+E1(2)+E1(3)+E1(4)) / T2 1240 J% = J%+1 1250 IF (J% < 6) GOTO 1200 1260 RETURN 1270 REM SUBROUTINE P0 1280 E1(J%) = E1(K%) 1290 E1(K%) = E1(L%) 1300 E1(L%) = E1(J%) 1310 RETURN 1320 REM SUBROUTINE P3(X,Y,Z) 1330 X1 = X 1340 Y1 = Y 1350 X1 = T * (X1+Y1) 1360 Y1 = T * (X1+Y1) 1370 Z = (X1+Y1)/T2 1380 RETURN 1390 REM REAL FUNCTION CPUTIM ( DUMMY ) 1400 REM THIS PROGRAM COMPUTES TOD SECONDS 1410 CPUTIM = TIME 1420 RETURN 1430 ' Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 100 ' Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 110 ' Whetstone Benchmark (BASIC) - Single Precision 120 T = .499975 130 T1 = .50025 140 T2 = 2! 150 INPUT " ENTER I VALUE: "; N% 160 I% = N% 170 ' Record Time of Day 180 GOSUB 1460 190 DT = CPUTIM 200 N1% = 0 210 N2% = 12 * I% 220 N3% = 14 * I% 230 N4% = 345 * I% 240 N5% = 0 250 N6% = 210 * I% 260 N7% = 32 * I% 270 N8% = 899 * I% 280 N9% = 616 * I% 290 N10% = 0 300 N11% = 93 * I% 310 ' Module 1: Simple Identifiers 320 X1 = 1! 330 X2 = -1! 340 X3 = -1! 350 X4 = -1! 360 FOR I% = 1 TO N1% 370 X1 = (X1+X2+X3-X4) * T 380 X2 = (X1+X2-X3+X4) * T 390 X4 = (-X1+X2+X3+X4) * T 400 X3 = (X1-X2+X3+X4) * T 410 NEXT I% 420 ' Module 2: Array Elements 430 E1(1) = 1! 440 E1(2) = -1! 450 E1(3) = -1! 460 E1(4) = -1! 470 FOR I% = 1 TO N2% 480 E1(1) = (E1(1)+E1(2)+E1(3)-E1(4)) * T 490 E1(2) = (E1(1)+E1(2)-E1(3)+E1(4)) * T 500 E1(3) = (E1(1)-E1(2)+E1(3)+E1(4)) * T 510 E1(4) = (-E1(1)+E1(2)+E1(3)+E1(4)) * T 520 NEXT I% 530 ' Module 3: Array as Parameter 540 FOR I% = 1 TO N3% 550 GOSUB 1220 560 NEXT I% 570 ' Module 4: Conditional Jumps 580 J% = 1 590 FOR I% = 1 TO N4 600 IF (J% = 1) THEN J% = 2 ELSE J% = 3 610 IF (J% > 2) THEN J% = 0 ELSE J% = 1 620 IF (J% < 1) THEN J% = 1 ELSE J% = 0 630 NEXT I% 640 ' Module 5: Omitted 650 ' Module 6: Integer Arithmetic 660 J% = 1 670 K% = 2 680 L% = 3 690 FOR I% = 1 TO N6% 700 J% = J% * (K%-J%) * (L%-K%) 710 K% = L% * K%-(L%-J%) * K% 720 L% = (L%-K%) * (K%+J%) 730 E1(L%-1) = J% + K% + L% 740 E1(K%-1) = J% * K% * L% 750 NEXT I% 760 ' Module 7: Trig. Functions 770 X = .5 780 Y = .5 790 FOR I% = 1 TO N7% 800 X = T*ATN(T2*SIN(X)*COS(X)/(COS(X+Y)+COS(X-Y)-1!)) 810 Y = T*ATN(T2*SIN(Y)*COS(Y)/(COS(X+Y)+COS(X-Y)-1!)) 820 NEXT I% 830 ' Module 8: Procedure Calls 840 X = 1! 850 Y = 1! 860 Z = 1! 870 FOR I% = 1 TO N8% 880 GOSUB 1360 890 NEXT I% 900 ' Module 9: Array References 910 J% = 1 920 K% = 2 930 L% = 3 940 E1(1) = 1! 950 E1(2) = 2! 960 E1(3) = 3! 970 FOR I% = 1 TO N9% 980 GOSUB 1310 990 NEXT I% 1000 ' Module 10: Integer Arithmetic 1010 J% = 2 1020 K% = 3 1030 FOR I% = 1 TO N10% 1040 J% = J%+K% 1050 K% = J%+K% 1060 J% = K%-J% 1070 K% = K%-J%-J% 1080 NEXT I% 1090 ' Module 11: Standard Functions 1100 X = .75 1110 FOR I% = 1 TO N11% 1120 X = SQR(EXP(LOG(X)/T1)) 1130 NEXT I% 1140 ' Compute Elapsed Time 1150 GOSUB 1460 1160 DT = CPUTIM - DT 1170 ' Compute Whetstone Rating 1180 W = ( N% ) * 100000! / DT 1190 PRINT " Weight = ", N%, " Elapsed time = ", DT, " CPU Sec." 1200 PRINT " Speed = ", W, " Whetstones/Sec." 1210 END 1220 REM SUBROUTINE PA(E) 1230 J% = 0 1240 E1(1) = (E1(1)+E1(2)+E1(3)-E1(4)) * T 1250 E1(2) = (E1(1)+E1(2)-E1(3)+E1(4)) * T 1260 E1(3) = (E1(1)-E1(2)+E1(3)+E1(4)) * T 1270 E1(4) = (-E1(1)+E1(2)+E1(3)+E1(4)) / T2 1280 J% = J%+1 1290 IF (J% < 6) GOTO 1240 1300 RETURN 1310 REM SUBROUTINE P0 1320 E1(J%) = E1(K%) 1330 E1(K%) = E1(L%) 1340 E1(L%) = E1(J%) 1350 RETURN 1360 REM SUBROUTINE P3(X,Y,Z) 1370 X1 = X 1380 Y1 = Y 1390 X1 = T * (X1+Y1) 1400 Y1 = T * (X1+Y1) 1410 Z = (X1+Y1)/T2 1420 RETURN 1430 ' REAL FUNCTION CPUTIM ( DUMMY ) 1440 ' THIS PROGRAM COMPUTES TOD SECONDS 1450 DIM C%(6) 1460 C1% = 194 1470 C2% = 193 1480 BREAD% = 32 1490 BHOLD% = 16 1500 BRESET% = 0 1510 OUT C2%,BHOLD% 1520 FOR J% = 1 TO 6 1530 K% = BREAD% + J% - 1 1540 OUT C1%,K% 1550 C%(J%) = INP(C1%) 1560 NEXT J% 1570 OUT C2%,BRESET% 1580 C%(6) = C%(6) AND 3 1590 CPUTIM = C%(6)*10 + C%(5) 1600 CPUTIM = CPUTIM*60! + C%(4)*10 + C%(3) 1610 CPUTIM = CPUTIM*60! + C%(2)*10 + C%(1) 1620 RETURN 1630 ' Copyright (C) 1985 Adam Fritz, 133 Main St., Afton, N.Y. 13730 10 CPUTIM = CPUTIM*60! + C%(2)*10 + C%(1) 1620 RETURN 1630 ' Copyright (