Calculating 10000 digits of Pi Tomaaz Member Posts: 51 Threads: 7 Joined: Feb 2024 Reputation: 0 02-07-2024, 06:07 PM (This post was last modified: 02-07-2024, 06:26 PM by Tomaaz.) OK. I know this is not the kind of program NaaLaa has been created for, but I use it to test the speed of any language I try. Well, NaaLaa is doing a pretty good job here and runing this example as fast as other fast interpreters.   Code:```n = 35001 a = 10000 d = 0 k = 0 g = 0 l = 0 f = [] for x = 0 to n     f[x] = 2000 next for c = n to 14 step -14         d = 0         for b = c to 1 step -1             d = d * b             g = b * 2 - 1             d = d + f[b] * a             f[b] = d % g             d = floor(d / g)             k = l + floor(d / a)         next         k2 = right("0000" + k, 4)         write k         l = d % a next``` EDIT: On my machine it takes about 1 min. to complete the task and this is the speed I'm expecting from an interpreted language. Python is slightly faster, while Perl being 25% faster than Python. Tcl is 10+ times slower than NaaLaa. It's worth to remember that NaaLaa runs through Wine, while Python, Perl and Tcl run natively. johnno56 Senior Member Posts: 253 Threads: 27 Joined: Nov 2023 Reputation: 3 02-07-2024, 10:49 PM Varies a little on my machine... averages between 15 and 21 seconds. Preventing the "text" being displayed made little to no difference in the running times... but still cool... Logic is the beginning of wisdom. Tomaaz Member Posts: 51 Threads: 7 Joined: Feb 2024 Reputation: 0 02-08-2024, 01:32 PM (This post was last modified: 02-08-2024, 01:33 PM by Tomaaz.) You definitely have a more powerful hardware. Preventing text from being displayed will not help here as the inner loop takes the most time in this example. 1micha.elok Member Posts: 159 Threads: 17 Joined: Nov 2023 Reputation: 0 02-12-2024, 02:08 AM (This post was last modified: 02-12-2024, 02:26 AM by 1micha.elok.) I added some lines at the bottom of the codes to measure it. Code:```pln "It took "+clock()/1000+" seconds" pln pln "Press ENTER to quit" temp=rln() 'pause``` On my computer, it took 30 seconds. ... My machine is slower than Johnno's « Next Oldest | Next Newest »