Post Reply 
Calculation of pi on many machines
11-23-2020, 08:56 PM (This post was last modified: 11-23-2020 09:50 PM by Gerson W. Barbosa.)
Post: #12
RE: Calculation of pi on many machines
(11-23-2020 06:38 PM)John Keith Wrote:  
(11-23-2020 04:51 AM)Benoit Maag Wrote:  More to come as I would like to run the benchmark on the 32sii, 35s, RPL machines, ...

A note as to RPL machines: the LongFloat library for the 49/50 can calculate pi up to 9999 digits. I would still be interested in seeing how a userRPL program would compare in speed.

Code:


DIR
  PiM
  « PUSH RAD -105 CF -3 CF DUP 2 / 5 DUP2 LOG / →NUM CEIL 2 * 1 - R→I ATN1X 
16 * 239 ROT OVER LOG / →NUM CEIL 2 * 1 - R→I ATN1X 4 * - EXPAND FXND DUP
 SIZE R→I ALOG OVER - PICK3 * SWAP IQUOT + →STR DUP HEAD 0 I→R →STR TAIL
 + SWAP TAIL + 1 ROT 2 + SUB POP
  »
  ATN1X
  « -1 UNROT 1 4 ROLLD OVER SQ PICK3 INV 4 ROLLD UNROT 3 SWAP
    FOR i OVER * DUP i * INV 5 PICK * 4 ROLL + UNROT 5 ROLL 4 ROLLD 2
    STEP DROP2 UNROT DROP2
  »
END

50 digits: 24.70 s
100 digits: 136.59 s

( HP 50g )

Unpractical running times henceforward, but then again my implementation might be far from optimal. EXPAND takes too much time for long expressions.

P.S.: If you prefer resorting to an external library, a LongFloat version is available here.

707 digits in 1858 seconds or roughly half an hour.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Calculation of pi on many machines - Gerson W. Barbosa - 11-23-2020 08:56 PM



User(s) browsing this thread: 4 Guest(s)