The Museum of HP Calculators

HP Forum Archive 15

 PI Decimals calculation on HP41cMessage #1 Posted by PHILIPPE on 3 May 2005, 3:50 p.m. Hi everybody, When I was a youg student, I used a program which allowed me to calculate thousands decimals digits of PI. It was a "stupid" game, but I was terribly impressed by this powerful calculation and watched during long, long minutes my lovely calculator. It was on a TI 58C but I remembered that the french magazine "Sciences et Vie" gave the same program for the hp 41C. More than 25 years after, i am looking for this program. is someone can help me? Thanks Philippe

 Re: PI Decimals calculation on HP41cMessage #2 Posted by Mike H on 3 May 2005, 4:00 p.m.,in response to message #1 by PHILIPPE Try here: http://www.voidware.com/calcs/pi.txt

 Re: PI Decimals calculation on HP41cMessage #3 Posted by PHILIPPE on 3 May 2005, 4:05 p.m.,in response to message #2 by Mike H THANK YOU MIKE!!!!!! PHILIPPE

 Re: PI Decimals calculation on HP41cMessage #4 Posted by GWB on 3 May 2005, 9:02 p.m.,in response to message #1 by PHILIPPE The best PI program for the 41C I know is one published in PPC Calculator Journal V7 N5 Page 9 June 1980, 'PI TO 1,110 PLACES' by Ron Knapp. It's based on Machin's formula: pi=16 arctan (1/5) - 4 arctan(1/239) Not the best method to calculate pi today, though. Anyway, it took "only" 11 1/2 hours to compute pi to 1000 places back then. Not bad considering that a contemporaneous Apple II program did that task in 40 hours. I've just run it on Emu42 running on my slow Pentium III: 1000 places in little less than 7 minutes. Regards, Gerson.

 Deep Pi - Some ResultsMessage #5 Posted by Mark Taylor on 4 May 2005, 12:46 a.m.,in response to message #1 by PHILIPPE I've been running the Deep Pi program found on voidware.com on 3 different HP-41CX's, each using an AC adapter, for several month now (continuously). Originally, the Deep Pi program calculated 6 digits of Pi at a time. But it was discovered that in at least one instance the 6th digit in a group was off by 1. Also, I modified the Deep Pi program by inserting a RUNSW and STOPSW to time the generation of each set of 6 digits. Those 2 commands appear at steps 2 and 9, respectively. Some results: The first 6 digits of PI (after the 3) take about 38 minutes. The "deeper" into Pi you go the longer it takes. Digits 619 thru 625 took over 274 hours, nearly 11.5 days. I'd never make it without the AC adapters plugged into the battery packs. I just love seeing my calculators really work. The Deep Pi program keeps my 41s cranking! Thanks Hugh Steers, for sharing Deep Pi on voidware.com. Mark Taylor

 Re: Deep Pi - Some ResultsMessage #6 Posted by hugh steers on 6 May 2005, 7:44 p.m.,in response to message #5 by Mark Taylor you’re most welcome, however, originally, i’d hoped the program would be interesting and find at least 1000 digits before slowing up too much, but in fact it slows up far too much way before that (eg around 200 digits). the idea of calculating stateless digit portions of pi comes from here: ```http://numbers.computation.free.fr/Constants/Algorithms/nthdigit.html ``` and this paper here: ```http://numbers.computation.free.fr/Constants/Algorithms/nthdecimaldigit.pdf ``` i did some work to improve and adapt this approach to calculators (10 digit overflow, for example). but its still not efficient enough. i'm hoping one, day the decimal version will be improved theoretically to make this an exciting possibility.

 Re: PI Decimals calculation on HP41cMessage #7 Posted by Marc on 4 May 2005, 6:23 a.m.,in response to message #1 by PHILIPPE Hi Philippe, Many years ago I played with the program published in "Science et Vie", and ported it to various calculators. By now the program is in my HP41 emulator, just for fun of course... Here it is : 01 LBL "PI" 02 CLRG 03 FIX 00 04 LBL 00 05 1 06 - 07 X=0? 08 GTO 03 09 VIEW X 10 100 11 STO 00 12 CLX 13 LBL 01 14 RCL IND 00 15 FRC 16 X<>Y 17 1 E5 18 / 19 X<> Z 20 * 21 + 22 INT 23 LASTX 24 FRC 25 X<> IND 00 26 INT 27 R^ 28 * 29 + 30 1 E5 31 / 32 INT 33 LASTX 34 FRC 35 1 E5 36 * 37 ST+ IND 00 38 RDN 39 DSE 00 40 GTO 01 41 1.1 42 STO 00 43 R^ 44 2 45 * 46 1 47 + 48 R^ 49 LBL 02 50 X<>Y 51 RCL IND 00 52 INT 53 1 E5 54 R^ 55 * 56 + 57 ENTER 58 R^ 59 / 60 INT 61 X<> IND 00 62 FRC 63 X<> Z 64 MOD 65 + 66 1 E5 67 * 68 ENTER 69 R^ 70 / 71 INT 72 1 E5 73 / 74 ST+ IND 00 75 RDN 76 X<>Y 77 MOD 78 ISG 00 79 GTO 02 80 X<>Y 81 1 82 - 83 2 84 / 85 2 E4 86 ST+ 01 87 X<>Y 88 GTO 00 89 LBL 03 90 FIX 05 91 1.1 92 STO 00 93 CLD 94 LBL 04 95 RCL IND 00 96 STOP 97 ISG 00 98 GTO 04 99 GTO 03 100 LBL 12 101 END I remember it was a VERY slow program, even at that time. The constants at lines 10, 41 and 91 determine the number of decimals to be computed (100 => 1,000 decimals). Have fun ! Marc

 Re: PI Decimals calculation on HP41c (with formatting)Message #8 Posted by Jeff O. on 4 May 2005, 7:31 a.m.,in response to message #7 by Marc Marc, I took the liberty of formatting your post. Feel free to edit yours, adding the [pre] and [\pre] codes before and after the program listing. Then delete this one, password 12345: Hi Philippe, Many years ago I played with the program published in "Science et Vie", and ported it to various calculators. By now the program is in my HP41 emulator, just for fun of course... Here it is : ``` 01 LBL "PI" 02 CLRG 03 FIX 00 04 LBL 00 05 1 06 - 07 X=0? 08 GTO 03 09 VIEW X 10 100 11 STO 00 12 CLX 13 LBL 01 14 RCL IND 00 15 FRC 16 X<>Y 17 1 E5 18 / 19 X<> Z 20 * 21 + 22 INT 23 LASTX 24 FRC 25 X<> IND 00 26 INT 27 R^ 28 * 29 + 30 1 E5 31 / 32 INT 33 LASTX 34 FRC 35 1 E5 36 * 37 ST+ IND 00 38 RDN 39 DSE 00 40 GTO 01 41 1.1 42 STO 00 43 R^ 44 2 45 * 46 1 47 + 48 R^ 49 LBL 02 50 X<>Y 51 RCL IND 00 52 INT 53 1 E5 54 R^ 55 * 56 + 57 ENTER 58 R^ 59 / 60 INT 61 X<> IND 00 62 FRC 63 X<> Z 64 MOD 65 + 66 1 E5 67 * 68 ENTER 69 R^ 70 / 71 INT 72 1 E5 73 / 74 ST+ IND 00 75 RDN 76 X<>Y 77 MOD 78 ISG 00 79 GTO 02 80 X<>Y 81 1 82 - 83 2 84 / 85 2 E4 86 ST+ 01 87 X<>Y 88 GTO 00 89 LBL 03 90 FIX 05 91 1.1 92 STO 00 93 CLD 94 LBL 04 95 RCL IND 00 96 STOP 97 ISG 00 98 GTO 04 99 GTO 03 100 LBL 12 101 END ``` I remember it was a VERY slow program, even at that time. The constants at lines 10, 41 and 91 determine the number of decimals to be computed (100 => 1,000 decimals). Have fun ! Marc

 Listing format problem !Message #9 Posted by Marc on 4 May 2005, 6:29 a.m.,in response to message #1 by PHILIPPE Hi again ! I read my posting and saw that the carriage returns were mysteriously deleted, resulting in an unusable listing. Here's another one, without line numbers : LBL "PI" CLRG FIX 00 LBL 00 1 - X=0? GTO 03 VIEW X 100 STO 00 CLX LBL 01 RCL IND 00 FRC X<>Y 1 E5 / X<> Z * + INT LASTX FRC X<> IND 00 INT R^ * + 1 E5 / INT LASTX FRC 1 E5 * ST+ IND 00 RDN DSE 00 GTO 01 1.1 STO 00 R^ 2 * 1 + R^ LBL 02 X<>Y RCL IND 00 INT 1 E5 R^ * + ENTER R^ / INT X<> IND 00 FRC X<> Z MOD + 1 E5 * ENTER R^ / INT 1 E5 / ST+ IND 00 RDN X<>Y MOD ISG 00 GTO 02 X<>Y 1 - 2 / 2 E4 ST+ 01 X<>Y GTO 00 LBL 03 FIX 05 1.1 STO 00 CLD LBL 04 RCL IND 00 STOP ISG 00 GTO 04 GTO 03 END I hope it'll be more readable. My apologies ! Marc

 Re: Listing format problem !Message #10 Posted by PHILIPPE on 4 May 2005, 6:44 a.m.,in response to message #9 by Marc dear all, Thank you all for your answers!!!! I am going to take some vacation this week and i will try both program to test what is the faster one....... I will keep you inform.... I am glad to see that I was not alone a long time ago to have fun with this crazy test. Marc,apparently it is not the same program between the 2 Mails. I understand that I have to use the last one which seems to be shorter Philippe

 SORRY MARC!!!Message #11 Posted by PHILIPPE on 4 May 2005, 6:55 a.m.,in response to message #9 by Marc Marc, Disregard my previous mail. I understand now!!!!! My brain is not working so fast that my HP 41....... Philippe

 Re: Listing format problem ! (with formatting)Message #12 Posted by Jeff O. on 4 May 2005, 7:34 a.m.,in response to message #9 by Marc Marc, Ditto previous message. password 12345: Hi again ! I read my posting and saw that the carriage returns were mysteriously deleted, resulting in an unusable listing. Here's another one, without line numbers : ```LBL "PI" CLRG FIX 00 LBL 00 1 - X=0? GTO 03 VIEW X 100 STO 00 CLX LBL 01 RCL IND 00 FRC X<>Y 1 E5 / X<> Z * + INT LASTX FRC X<> IND 00 INT R^ * + 1 E5 / INT LASTX FRC 1 E5 * ST+ IND 00 RDN DSE 00 GTO 01 1.1 STO 00 R^ 2 * 1 + R^ LBL 02 X<>Y RCL IND 00 INT 1 E5 R^ * + ENTER R^ / INT X<> IND 00 FRC X<> Z MOD + 1 E5 * ENTER R^ / INT 1 E5 / ST+ IND 00 RDN X<>Y MOD ISG 00 GTO 02 X<>Y 1 - 2 / 2 E4 ST+ 01 X<>Y GTO 00 LBL 03 FIX 05 1.1 STO 00 CLD LBL 04 RCL IND 00 STOP ISG 00 GTO 04 GTO 03 END ``` I hope it'll be more readable. My apologies ! Marc

 Jeff, thank you very much ! (NT)Message #13 Posted by Marc on 4 May 2005, 9:01 a.m.,in response to message #12 by Jeff O. ;-)

Go back to the main exhibit hall