Post Reply 
Calculation of pi on many machines
03-08-2021, 02:10 PM
Post: #21
RE: Calculation of pi on many machines
Very nice comparison! I especially like the inclusion of the Casio fx-6300G, as these old Casios are great to program (I sometimes use an old Casio to prototype an algorithm before implementing on an RPN calculator), and the "old world" models up through the fx-9700GE and cfx-9800G - i.e. the "Defm" models - have very easy-to-use indirect addressing, as demonstrated here. However, there is a bug you have to watch out for on the fx-6300G when using indirect addressing in combination with comparison tests:

http://dave.brittens.org/blog/fx-6300g-c...n-bug.html
Visit this user's website Find all posts by this user
Quote this message in a reply
03-09-2021, 08:13 AM
Post: #22
RE: Calculation of pi on many machines
(03-08-2021 02:10 PM)Dave Britten Wrote:  ... there is a bug you have to watch out for on the fx-6300G when using indirect addressing in combination with comparison tests:

http://dave.brittens.org/blog/fx-6300g-c...n-bug.html
What an excellent bug! Thanks for sharing your thorough investigation.
Find all posts by this user
Quote this message in a reply
03-16-2022, 08:25 PM
Post: #23
RE: Calculation of pi on many machines
(03-08-2021 02:30 AM)berndpr Wrote:  But I got another program from a japanese person (Hiro510) which is using different version of pi/4 approximations (like Leibniz, Machin, Klingenstirna, Gauss, Störmer, Takano Kikuo and 2 unknown).

Not the same program or the same author, I think, but perhaps of interest: in my web travels I've just found a ruby program by "komasaru" which evaluates 8 different arctangent formulas:
1:Machin, 2:Klingenstierna, 3:Euler, 4:Euler(2)
5:Gauss, 6:Stormer, 7:Stormer(2), 8:Takano
Looks like there are versions in other languages too - see here.
Find all posts by this user
Quote this message in a reply
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
09-30-2022, 01:04 AM
Post: #25
RE: Calculation of pi on many machines
(11-23-2020 01:01 AM)Gerson W. Barbosa Wrote:  7 seconds for 4900 digits on the iPhone 7 running Ron Knapp’s program (Free42).
Code:

00 { 629-Byte Prgm }
01▸LBL "PI"
02 CLRG
03 CF 29
04 FIX 00
05 9
06 +
07 10
08 ÷
09 IP
10 2
11 ×
12 5
13 +
14 ARCL IND ST X
15 5
16 +
17 2
18 ÷
19 STO 02
20 1.07
21 ×
22 5
23 -
24 RND
25 4
26 ×
27 1
28 -
29 4ᴇ-5
30 +
31 STO 01
32▸LBL 00
33 RCL 01
34 IP
35 ENTER
36 ENTER
37 ENTER
38 4.3
39 ÷
40 IP
41 1
42 X>Y?
43 X<>Y
44 R↓
45 +/-
46 RCL 02
47 +
48 1ᴇ3
49 ÷
50 4
51 +
52 STO 00
53 STO 03
54 R↓
55 239
56 X↑2
57 ×
58 X<>Y
59 2
60 -
61 STO× ST Z
62 -
63 0
64 X<>Y
65 4
66 ×
67 XEQ 03
68 239
69 X↑2
70 X↑2
71 ENTER
72 ENTER
73 RCL 03
74 STO 00
75 CLX
76 DSE 01
77 GTO 04
78 X<>Y
79 239
80 ÷
81 X<>Y
82 XEQ 06
83 GTO 08
84▸LBL 04
85 XEQ 06
86 GTO 00
87▸LBL 02
88 1ᴇ5
89 ×
90 ENTER
91 R↑
92 STO÷ ST Z
93 MOD
94 X<>Y
95 IP
96 1ᴇ5
97 STO× ST Z
98 ×
99 X<>Y
100▸LBL 03
101 ENTER
102 R↑
103 STO÷ ST Z
104 MOD
105 LASTX
106 X<>Y
107 R↑
108 R↑
109 IP
110 +
111 1ᴇ10
112 -
113 RCL IND 00
114 +
115 X<0?
116 GTO 04
117 1
118 STO- 00
119 STO+ IND 00
120 STO+ 00
121 CLX
122 +
123 GTO 05
124▸LBL 04
125 1ᴇ10
126 +
127▸LBL 05
128 STO IND 00
129 CLX
130 +
131 ISG 00
132 GTO 02
133 RTN
134▸LBL 06
135 1ᴇ5
136 ×
137 ENTER
138 R↑
139 STO÷ ST Z
140 MOD
141 X<>Y
142 IP
143 1ᴇ5
144 X>Y?
145 GTO 07
146 ÷
147 IP
148 1
149 STO- 00
150 X<>Y
151 STO+ IND 00
152 R↓
153 STO+ 00
154 CLX
155 LASTX
156 FP
157 1ᴇ5
158 ×
159 LASTX
160▸LBL 07
161 ×
162 X<> IND 00
163 LASTX
164 ÷
165 IP
166 STO+ ST Y
167 X<> ST L
168 FP
169 X<>Y
170 1ᴇ5
171 STO× ST Z
172 ×
173 ENTER
174 R↑
175 STO÷ ST Z
176 MOD
177 LASTX
178 R↓
179 X<>Y
180 IP
181 STO+ IND 00
182 CLX
183 +
184 +
185 ISG 00
186 GTO 06
187 RTN
188▸LBL 08
189 SF 29
190 RCL 02
191 RCL 03
192 IP
193 -
194 STO+ 02
195 1.2
196 ×
197 0.9
198 -
199 RND
200 12
201 ×
202 1
203 -
204 6ᴇ-5
205 +
206 STO 01
207▸LBL 09
208 RCL 01
209 IP
210 ENTER
211 14.3
212 ÷
213 IP
214 1
215 X>Y?
216 X<>Y
217 R↓
218 +/-
219 RCL 02
220 +
221 LASTX
222 2
223 STO÷ ST Y
224 +
225 X<>Y
226 1ᴇ3
227 ÷
228 +
229 STO 00
230 STO 03
231 SF 00
232▸LBL 10
233 RCL 01
234 IP
235 ENTER
236 ENTER
237 ENTER
238 2
239 -
240 STO× ST Z
241 25
242 STO× ST Z
243 X<>Y
244 ×
245 2
246 STO- ST L
247 CLX
248 LASTX
249 STO× ST T
250 STO- ST Y
251 R↓
252 ×
253 R↑
254 STO+ ST T
255 X↑2
256 R↑
257 +
258 +
259 FS? 00
260 GTO 04
261 5ᴇ6
262 ×
263 0.75
264 GTO 05
265▸LBL 04
266 DSE 01
267 40
268 ×
269 6
270▸LBL 05
271 STO÷ ST Z
272 CLX
273 X<>Y
274 XEQ 12
275 RCL 03
276 STO 00
277 FS?C 00
278 GTO 10
279 125
280 X↑2
281 X↑2
282 ENTER
283 ENTER
284 0
285 DSE 01
286 GTO 07
287 3
288 STO× ST Z
289 STO× ST T
290 R↓
291 XEQ 06
292 GTO 13
293▸LBL 07
294 XEQ 06
295 GTO 09
296▸LBL 11
297 ENTER
298 R↑
299 STO÷ ST Z
300 MOD
301 X<>Y
302 IP
303 X<>Y
304 1ᴇ5
305 STO× ST Z
306 ×
307▸LBL 12
308 ENTER
309 R↑
310 STO÷ ST Z
311 MOD
312 X<>Y
313 LASTX
314 R↓
315 IP
316 STO+ ST Z
317 CLX
318 +
319 1ᴇ5
320 ×
321 X<>Y
322 RCL IND 00
323 -
324 X<0?
325 X>0?
326 GTO 04
327 1
328 STO- 00
329 STO- IND 00
330 STO+ 00
331 CLX
332 1ᴇ10
333 +
334▸LBL 04
335 STO IND 00
336 R↓
337 ISG 00
338 GTO 11
339 RTN
340▸LBL 13
341 RCL 03
342 FP
343 LASTX
344 IP
345 1
346 -
347 STO 00
348 1ᴇ3
349 STO× ST Z
350 ÷
351 STO 01
352 +
353 STO 03
354 CLX
355▸LBL 14
356 RCL IND 03
357 X<>Y
358 -
359 RCL IND 00
360 -
361 0
362 X<>Y
363 X<0?
364 X>0?
365 GTO 05
366 1ᴇ10
367 +
368 1
369 X<>Y
370▸LBL 05
371 STO IND 00
372 R↓
373 DSE 00
374 DSE 03
375 GTO 14
376▸LBL 01
377 RCL 01
378 4
379 +
380 STO 00
381 VIEW IND 00
382 PSE
383 ISG 00
384 FIX 05
385 BEEP
386▸LBL 15
387 RCL IND 00
388 1ᴇ5
389 ÷
390 VIEW ST X
391 ISG 00
392 GTO 15
393 RTN
394 GTO 01
395 END

hi, thanks for sharing!

is there a .raw format of this file? I tried to import into free42 on my ipad and android phone...
Find all posts by this user
Quote this message in a reply
Post Reply 




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