Post Reply 
Calculation of pi on many machines
11-26-2020, 02:40 PM
Post: #19
RE: Calculation of pi on many machines
The Science et Vie formula makes for very short programs, but they are too slow.

Code:

« PUSH RAD -105 CF -3 CF 2 OVER 2 LOG / CEIL DUPDUP + 1 + UNROT 1
  FOR i i * SWAP DUP 2 - UNROT / 2 + -1
  STEP NIP 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
»

# FE89h, 200 bytes.

51 decimal digits: 634.528 s.

Most of the slowness is due to the difficulty of EXPAND to process the long resulting algebraic expression, however. For benchmarking purposes it is better to take a more conventional approach.
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-26-2020 02:40 PM



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