Post Reply 
Summation based benchmark for calculators
09-06-2018, 09:46 PM
Post: #137
RE: Summation based benchmark for calculators
(09-06-2018 09:30 PM)Guenter Schink Wrote:  a different result for NUMWORKS (Python script)

Someone posted that 100000 iterations would take 84sec. My script does it within 68sec. Perhaps I made a mistake? I'm not at all experienced with Python.

So here is the short script
Code:

from math import *
x=0
for i in range(1,100001):
 x=x+pow(exp(sin(atan(i))),1/3)
print(x)

Result is 139560.97614110521

Günter

As was pointed out to me over in this thread, you can significantly speed up Micro Python code by doing the work inside a function.

This version runs in about 57 seconds on my Casio fx-CG50, producing 139560.9761410521:

Code:
from math import *
def RunTest():
  x=0
  for i in range(1,100001):
    x=x+pow(exp(sin(atan(i))),1/3)
  print(x)

RunTest()
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Summation based benchmark for calculators - Dave Britten - 09-06-2018 09:46 PM



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