• Please review our updated Terms and Rules here

Tektronix 4051 vs 4054A performance calculating the value of PI

nikola-wan

Veteran Member
Joined
Mar 7, 2018
Messages
1,296
Location
Texas, USA
Here is a program to calculate PI - by Kerry Richens in the Retro Microcomputers facebook group. I was curious how fast his program would run on my Tektronix 4054A computer. I used Kerry's "10 minutes and 21 seconds" to compute PI to 60 digits timing in his video of his restored 4051 to compare with the 4051 Emulator, and scaled the speed of the Emulator to match his 60 digit PI calculation timing. The 4051 Emulator includes a Real Time Clock GPIB device 2, so I added a couple of lines to Kerry's program to time the results. My 4054A has a Multifunction ROM Pack from @jdreesen that holds eight option ROMs and also provides a TransEra Real-Time-Clock for the 4052/4054. I've attached a picture of the performance comparison. It shows the custom bit-slice CPU in the 4054A is 8.4x faster running Kerry's program to calculate PI to 60 digits than the 4051!

4051 Emulator vs 4054A calculating PI.png

Here is the BASIC program listing for my 4054A. Just delete lines 53-57 and 530-560 if you don't have the TransEra RTC.

Code:
10 PAGE
20 INIT
25 PRINT " Kerry's Electroarchaeology Oct 2022"
26 PRINT
30 PRINT "Modified for Tektronix 4050 BASIC by Kerry"
31 PRINT
32 PRINT "Tek BASIC internal PI constant = ";PI
33 PRINT
34 PRINT "22/7 approximation of PI = ";22/7
35 PRINT
37 PRINT "355/113 appproximation of PI = ";355/113
40 PRINT
50 PRINT " Enter number of digits--> ";
51 INPUT N
52 PRINT
53 CALL "!DATETIME",A$
54 PRINT A$
55 PRINT
56 CALL "!SECONDS",S
57 T=S
60 L=INT(10*N/3)
70 DIM A(255)
80 Z$="000000"
90 T$="999999"
100 FOR I=1 TO L
110 A(I)=2
120 NEXT I
130 M=0
140 P=0
150 FOR J=1 TO N
160 Q=0
170 K=2*L+1
180 FOR I=L TO 1 STEP -1
190 K=K-2
200 X=10*A(I)+Q*I
210 Q=INT(X/K)
220 A(I)=X-Q*K
230 NEXT I
240 Y=INT(Q/10)
250 A(1)=Q-10*Y
260 Q=Y
300 IF Q<>9 THEN 350
310 M=M+1
320 GO TO 450
350 IF Q<>10 THEN 400
360 C$=STR(P+1)
361 D$=SEG(Z$,1,M)
363 E$=SEG(C$,2,1)
365 PRINT E$;D$;
370 P=0
380 N=0
390 GO TO 450
400 C$=STR(P)
401 D$=SEG(T$,1,M)
403 E$=SEG(C$,2,1)
405 PRINT E$;D$;
410 P=Q
420 M=0
450 NEXT J
500 C$=STR(P)
501 E$=SEG(C$,2,1)
502 PRINT E$
510 PRINT
520 PRINT "Done"
530 CALL "!DATETIME",A$
540 CALL "!SECONDS",S
550 T=S-T
560 PRINT "",A$,""," Time= ";T;" seconds"
600 END
 
Last edited:
Back
Top