Damus
electron.greg profile picture
electron.greg
@electron.greg
Tested various micros running this program. It derives Pi to 20 decimal places. Interesting stats.

1 N=20: L=INT(10*N/3): DIM A(255): Z$="000000":T$="999999"
2 FOR I=1 TO L: A(I)=2: NEXT I: M=0: P=0: FOR J=1 TO N: Q=0: K=2*L+1
3 FOR I=L TO 1 STEP -1: K=K-2: X=10*A(I)+Q*I: Q=INT(X/K): A(I)=X-Q*K: NEXT I
4 Y =INT(Q/10): A(1)=Q-10*Y: Q=Y: IF Q=9 THEN LET M=M+1: GOTO 7
5 IF Q=10 THEN PRINT STR$(P+1);LEFT$(Z$,M);: P=0: M=0: GOTO 7
6 PRINT STR$(P);LEFT$(T$,M);: P=Q: M=0
7 NEXT J:PRINTSTR$(P)

#BBCMicro : 19.5
#AcornElectron : 25
#VIC20 : 36
#C64 : 43
#C16 : 46
#CBMPET : 43
#ZX80 : 56.75
#Altair8800 : 52
1
Sasha · 1w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqwkys6gg9q7794g468zxks0r73rhey6xunwg0a2dh4dyyukll3kssjcvw20 BBC Basic really is tip top