Leibniz formula for π on HP 35s
|
05-06-2020, 02:45 PM
Post: #1
|
|||
|
|||
Leibniz formula for π on HP 35s
I got inspired by this vintage computer race to use the slow-converging alternating Leibnitz series method to approximate π.
It's a few years old, but in the video an HP 9825B from 1980 takes 60 seconds to compute π to four decimal places, while an Android Fairphone 2 from 2015 takes 6 seconds to make the same computation. The HP was programmed in HPL; the Android in Python. Obviously the 2.26 GHz droid could run a lot faster, but it's running an interpreted language with lots of overhead. How well can the underpowered 33 kHz processor in the HP 35s perform in RPN? My first attempt took 4 minutes and 45 seconds, but this program, my fifth revision, is 28 instructions long and takes 2 minutes and 40 seconds (160 seconds) to calculate 4 digits of π on the HP 35s: Code:
Controlling for clockspeed, that's 68x more efficient than the HP 9825B and 2750x more efficient than the smartphone! Of course, I'm cheating a little by running four loops of precisely 845 iterations, but even with a less arbitrary/optimized value of 1000, it's almost as fast. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Leibniz formula for π on HP 35s - lipoff - 05-06-2020 02:45 PM
RE: Leibniz formula for π on HP 35s - PedroLeiva - 05-06-2020, 05:09 PM
RE: Leibniz formula for π on HP 35s - lipoff - 05-07-2020, 09:08 AM
RE: Leibniz formula for π on HP 35s - Gerson W. Barbosa - 05-06-2020, 05:59 PM
RE: Leibniz formula for π on HP 35s - lipoff - 05-07-2020, 09:47 AM
|
User(s) browsing this thread: 1 Guest(s)