Post Reply 
Calculation of pi on many machines
03-16-2022, 10:46 PM
Post: #24
RE: Calculation of pi on many machines
.
Hi, Benoit,

(11-22-2020 08:05 PM)Benoit Maag Wrote:  Not a new subject by a long shot, the attached PDF lists programs to calculate pi with many decimals on many machines and benchmarking their relative speeds [...]

Thanks for the interesting document, I've downloaded it to my References folder. I initially understood that you'd use different algorithms for the various machines, but it was mostly the same one for all of them, which indeed is most useful for fair comparison among them.

I'm pretty busy at the time and couldn't read it carefully right now (will do in a few days) but I've noticed that your DM42 program is almost the 41C's one verbatim, and so it doesn't include fairly obvious optimizations that can't apply to the 41C, for instance:
    o The constant 1 E17 appears many times, always mutiplying or dividing something. You'd save a lot of bytes and would also speed the program if you stored 1 E17 in some register at the beginning and then used it together with RCL arithmetic, i.e., assuming 1 E17 is stored in R04 (say):

      28 1E17, 29 / -> 28 RCL/ 04
      31 1E17, 32 * -> 31 RCL* 04
      47 1E17, 48 / -> 47 RCL/ 04
      59 1E17, 60 * -> 59 RCL* 04
      68 1E17, 69 * -> 68 RCL* 04
      71 1E17, 72 / -> 71 RCL/ 04

plus 44 RCL 01, 45 * -> 44 RCL* 01. As I said, this will save many bytes and time.

Also, perhaps you would consider using the DM42 (HP42S) native mnemonics, i.e., ST+ X -> STO+ ST X, and so on. It would help clarity and make it easier to key in the program. If you do these changes, please tell us the new program size and running times.

Quote:And if you have an HP-71B, Valentin has a 6 line program (!) at:

https://albillo.hpcalc.org/programs/HP%2...20time.pdf

Again, thanks for mentioning and including a link to my article, much appreciated.

Regards.
V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website 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 - Valentin Albillo - 03-16-2022 10:46 PM



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