Π day
|
03-17-2022, 08:25 PM
Post: #28
|
|||
|
|||
RE: Π day
Back in March of 2004, Olivier De Smet posted this fairly compact RPL version of a pi digits program (see post #17):
Code: %%HP: T(3)A(R)F(.); It uses exact integers for intermediate computations, thus providing digit counts in excess of the inherent approximate limitations. He attributed it as an RPL translation of a program originally posted by Katie Wasserman which was written for the HP 32SII. Katie, in turn, cited the algorithm as essentially being the Euler/Machin approach (Pi = 20 * arctan(1/7) + 8 * arctan(3/79)). As soon as I saw Olivier's version some time last year, I wanted to try a SysRPL implementation based on his code that would avoid the inherent performance penalty of IQUOT. This seemed like a good time to try it. This is essentially Olivier's program, but coded in SysRPL and providing a result rounded to the specified number of digits (Olivier's provides 6 additional digits). The code will compile on a 49g+/50g with the standard HP extable installed (use 256.06 MENU ASM). I've used some DCs and DEFINEs to simplify the code listing a bit. Code: !NO CODE Performance improved, as expected. Generating 1000 digits with Olivier's original RPL program takes about 231 seconds (you actually get 1006 digits, but the last 4 are not accurate). Generating 1006 digits using the SysRPL version takes about 111 seconds, and all resulting digits appear to be correct (at least they match Wolfram Alpha's output for 1006 digits). The usual advantages of SysRPL apply here, but a significant part of the improvement is in bypassing the overhead of IQUOT and going straight to the internal exact integer division code. I'm sure NewRPL on the 50g and Python on the Prime would perform much better, but I thought this was reasonable performance for the task at hand on the original 50g platform. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
RE: Π day - Dave Britten - 03-14-2022, 11:44 AM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 12:25 PM
RE: Π day - Dave Britten - 03-14-2022, 06:15 PM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 11:53 AM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 06:06 PM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 10:30 PM
RE: Π day - Gerson W. Barbosa - 03-14-2022, 08:29 PM
RE: π day - Thomas Klemm - 03-14-2022, 09:17 PM
RE: Π day - Eddie W. Shore - 03-15-2022, 01:09 AM
RE: π day - Thomas Klemm - 03-15-2022, 07:55 PM
RE: Π day - Thomas Klemm - 03-17-2022, 03:40 AM
RE: Π day - Thomas Klemm - 03-17-2022, 03:54 AM
RE: Π day - Gerson W. Barbosa - 03-17-2022, 11:39 AM
RE: Π day - Thomas Klemm - 03-17-2022, 12:29 PM
RE: Π day - Gerson W. Barbosa - 03-17-2022, 02:10 PM
RE: Π day - Ángel Martin - 03-18-2022, 09:07 AM
RE: Π day - Frido Bohn - 03-19-2022, 09:45 AM
RE: Π day - Ángel Martin - 03-19-2022, 11:17 AM
RE: Π day - Frido Bohn - 03-19-2022, 01:01 PM
RE: Π day - Frido Bohn - 03-19-2022, 03:13 PM
RE: Π day - DavidM - 03-17-2022 08:25 PM
RE: Π day - Steve Simpkin - 03-18-2022, 04:31 AM
RE: Π day - MeindertKuipers - 03-18-2022, 10:48 AM
RE: Π day - Ángel Martin - 03-18-2022, 11:04 AM
RE: Π day - Ángel Martin - 03-19-2022, 11:18 AM
RE: Π day - Ángel Martin - 03-20-2022, 07:39 AM
RE: Π day - Frido Bohn - 03-20-2022, 07:28 PM
RE: π day - Thomas Klemm - 03-21-2022, 07:24 AM
RE: Π day - Frido Bohn - 03-21-2022, 04:03 PM
RE: Π day - Albert Chan - 03-21-2022, 10:45 PM
RE: Π day - Gerson W. Barbosa - 03-24-2022, 01:36 AM
RE: Π day - Albert Chan - 03-26-2022, 03:59 PM
RE: Π day - Gerson W. Barbosa - 03-26-2022, 05:37 PM
RE: Π day - Thomas Klemm - 03-21-2022, 05:27 PM
RE: π day - Thomas Klemm - 03-21-2022, 05:54 PM
RE: π day - Thomas Klemm - 03-21-2022, 06:33 PM
RE: Π day - Albert Chan - 03-26-2022, 11:24 PM
RE: Π day - Albert Chan - 03-27-2022, 01:44 PM
RE: Π day - Albert Chan - 03-27-2022, 04:00 PM
|
User(s) browsing this thread: 2 Guest(s)