Elektrine lite

← Feed

@electron_greg@oldbytes.space

Post #1380058

2026-04-15 16:17 UTC

Tested various micros running this FLOATING POINT 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:PRINT STR$(P) #RC2014 : 14 (thank you JonV) #BBCMicro : 19 #AmstradCPC : 22 (thank you Devlin) #AcornElectron : 25 #C128 : 27 (fast mode - thank you Jonas H) #VIC20 : 36 #AcornAtom : 37 #CBMPET : 43 #C64 : 43 #Dragon32 : 44 #C16 : 46 #Altair8800 : 52 #MSX : 53 (thank you Pixel Purrito) #C128 : 56 (default "mode") #ZX80 : 57 #ZXSpectrum : 68 (thank you Adam) Edit: now ordered (seconds)

Replies (14)

  • Ran the program on a Dragon 32 emulator as I sold my actual machine.

    Open ##1540071

  • @gpowerf@mastodon.social 2026-04-15 16:23

    @electron_greg Very cool! This is the sort of nerdy stuff I love to see! Do you have a ZX81 or Amstrad CPC?

    Open ##1540073

  • @electron_greg would there be a difference between the ZX80 & 81 do you think?

    Open ##1540080

  • @geoffl@mastodon.me.uk 2026-04-15 16:51

    @electron_greg Making no structural changes to the program but using integer variables on the beeb and electron would probably halve their times.

    Open ##1540083

  • @wec@fv390.hs.bam.moe 2026-04-15 17:38

    slightly modified to work on one of IBM's BASIC runtimes; it completed basically instantly on an old System/390 mainframe

    Open ##1540085

  • @oscherler@tooting.ch 2026-04-15 18:57

    @electron_greg Nice. In high school we calculated π to a few hundred decimals using π/4 =atan(1/2)+atan(1/3), the Taylor series of atan, and implementing addition and multiplication on arbitrary large numbers represented by arrays of digits. I don’t remember what we did for division, though, because I don’t recall implementing it the way we do it by hand. We wrote all that in BASIC on a Smaky (68k-based Swiss computer designed for schools.)

    Open ##1540103

  • @Robsonde@mastodon.social 2026-04-15 19:33

    @electron_greg what’s the underlying algorithm?

    Open ##1540104

  • @apa@oldbytes.space 2026-04-15 22:33

    @electron_greg I’m going to try this on a ZX Spectrum tomorrow, although I expect it to be about the same as the ZX81

    Open ##1540118

  • @gpowerf@mastodon.social 2026-04-16 10:01

    @electron_greg The Commodore 128 barely beating the ZX80 is not something I could have predicted!

    Open ##1540127

  • @cs99cjb@hachyderm.io 2026-04-16 14:25

    @electron_greg Nice 32 year gap between first and second place.

    Open ##1540132

  • @electron_greg four machines from the UK leading the list ... and who would have thought that the good old VIC-20 would be that quick ...

    Open ##1540134

  • @retrofan64@oldbytes.space 2026-04-16 16:44

    @electron_greg for fun: #mega65 40mhz: 1 1mhz: 28

    Open ##1612047

  • @alrj@hostux.social 2026-04-16 20:34

    @electron_greg Oh, this is fun! I had to adapt the code a bit to Palo-Alto Tiny Basic on BB-88, my breadboard 8088 computer (no string variables, int only, restrictions on for loops,...) 18.09s, not too bad for a non-tokenizer basic interpreter. The computer is running at stock 4.77 MHz, I cannot switch it to turbo mode from the Basic in ROM. Here's the code, and the computer it runs on.

    Open ##1896837

  • @aperezdc@oldbytes.space 2026-04-17 20:19

    @electron_greg I have tested this on a Panasonic FS-A1WSX #MSX computer, which has a software-selectable speed switch for the Z80. The results were: 53s at 3.58 MHz46s at 5.37 Mhz Edit: pictures added, the spacing in the output is amusing but I didn't care to figure out why that happens.

    Open ##1896839