HP Forums

Full Version: Summation based benchmark for calculators
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
I think we have new champion -- by quite a margin

Prime G2 Beta 2.1.14549 using Python
Code:
#PYTHON name
from math import *
import sys
import hpprime
t=hpprime.eval("time")
c=int(sys.argv[0])
print()
print("Exponent = ",c)
print("Iterations = ", 10**c)
a=0
for i in range(1, 10**c+1):
    a=a+pow((e**(sin(atan(i)))),1/3) 
print("Time (sec) = ",round(hpprime.eval("time")-t,4))
print("Sum = ",a)
#end
Export sums(c)
Begin
  PYTHON(name, c);
End;

From the Home screen invoke this Python program with sums(?)

where "?" question mark has to be replaced by the exponent which denotes the magnitude
  • 3 for 1000
  • 4 for 10 000
  • 5 for 100 000
  • 6 for 1 000 000

Output will be the exponent, the resulting number, the time and the sum. E.g.
3
1000
0.036 sec
1395.3462877433426


Code:
Results:
3       1 000  0.036 sec     1395.3462877433426
4      10 000  0.159 sec    13955.857904429155
5     100 000  1.425 sec   139560.9761410521
6   1 000 000 14.046 sec  1395612.158725383

I think that's quite impressive specifically when compared with the values for native PPL.

Günter

Edit: put the timing into the Python code rather than using TEVAL
Something new to me, maybe a lack of Prime knowledge.
My Prime is configured in RPN (for stack Home computations).

I tried the sum "benchmark" proposed here, then Pick (copy) the first formula to modify it in the command line, I want to run a bigger one, from a 1000 to 10000 sum.
I only added a zero behind "1000", the Editor refuses to validate the formula. Why ?

[Image: wgZJbrL] https://ibb.co/wgZJbrL
[Image: VD2Wzp6] https://ibb.co/VD2Wzp6
[Image: WfpDSGv] https://ibb.co/WfpDSGv
Finally updated up to post #221 (yay after years! Well priorities...)

It took more than 2 hours, so it wasn't that trivial.

Updated also here: http://www.wiki4hp.com/doku.php?id=bench...g_exp_root
and here: https://osdn.net/users/pier4r/pf/various...chmark.txt

I am not so sure about some results regarding 500k with the prime G2. Now you all need to add more entries so that I have to catch up again Big Grin
(08-05-2021 04:06 PM)pier4r Wrote: [ -> ]Finally updated up to post #221 (yay after years! Well priorities...)

It took more than 2 hours, so it wasn't that trivial.

Updated also here: http://www.wiki4hp.com/doku.php?id=bench...g_exp_root
and here: https://osdn.net/users/pier4r/pf/various...chmark.txt

I am not so sure about some results regarding 500k with the prime G2. Now you all need to add more entries so that I have to catch up again Big Grin

The HP Expander (not XP Expander) is a calculator from HP, not a mobile device. It never saw the light of the markets. I've got a prototype at one of the HHCCs.

Günter
(08-08-2021 10:59 AM)Guenter Schink Wrote: [ -> ]The HP Expander (not XP Expander) is a calculator from HP, not a mobile device. But I think it never saw the light of the markets. I've got a prototype at one of the HHCCs.

It actually was "HP Xpander".
Have a couple, from different development stages.
(08-08-2021 11:03 AM)Massimo Gnerucci Wrote: [ -> ]
(08-08-2021 10:59 AM)Guenter Schink Wrote: [ -> ]The HP Expander (not XP Expander) is a calculator from HP, not a mobile device. But I think it never saw the light of the markets. I've got a prototype at one of the HHCCs.

It actually was "HP Xpander".
Have a couple, from different development stages.

Thanks for the correction. I could have had a closer look either to the device or the Wiki article Smile

Günter
ThetaCalc, an RPN calculator app running on iOS which can be programmed in JavaScript, produced the following result for n = 1000000 on an iPhone 12:

HP museum benchmark (n = 1000000)
Sum = 1395612.1587253837
Time = 0.189 seconds

I don't know, however, whether the app fits into one of the given categories.

Here is the program:

Code:
function benchmark(n) {
  let s = 0;
  for (let i = 1; i <= n; i++) {
    s += Math.pow(
      Math.exp(
        Math.sin(
          Math.atan(i))), 1/3);
  }
  return s;
}

const n = 1000000;
startTimer();
let s = benchmark(n);
stopTimer();
println(`HP museum benchmark (n = ${n})`);
println(`Sum = ${s}`);
printlnElapsed();
I recently received a Sharp PC-1201 and was currious how this nice little machine would perform, here are the results :

N=10 ~25s result 13,318529402
N=100 ~285s result 138,90159786
N=1000 ~2844s result 1394,95067416
(04-22-2021 06:33 PM)Guenter Schink Wrote: [ -> ]I think we have new champion -- by quite a margin

Prime G2 Beta 2.1.14549 using Python

When I copy and paste that code into the emulator, I get

Code:
Traceback (most recent call last):  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 10: '10\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
(08-17-2021 11:23 PM)toml_12953 Wrote: [ -> ]
(04-22-2021 06:33 PM)Guenter Schink Wrote: [ -> ]I think we have new champion -- by quite a margin

Prime G2 Beta 2.1.14549 using Python

When I copy and paste that code into the emulator, I get

Code:
Traceback (most recent call last):  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 10: '10\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'

I just also copied it to the virtual Prime. works flawlessly. (?)

The error actually points to line 6 "c=int(sys.argv[0])" Can't assume what's going wrong.

Günter
(08-18-2021 03:09 PM)Guenter Schink Wrote: [ -> ]
(08-17-2021 11:23 PM)toml_12953 Wrote: [ -> ]When I copy and paste that code into the emulator, I get

Code:
Traceback (most recent call last):  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 10: '10\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'
Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
ValueError: invalid syntax for integer with base 
10: '1\xef\xb9\x90000'

I just also copied it to the virtual Prime. works flawlessly. (?)

The error actually points to line 6 "c=int(sys.argv[0])" Can't assume what's going wrong.

Günter

I had digit grouping set to 123,456.789. When I change it to 123456.789, I don't get an error but I get a lot of zeroes on the screen and what may be an infinite loop.
(08-18-2021 04:01 PM)toml_12953 Wrote: [ -> ]I had digit grouping set to 123,456.789. When I change it to 123456.789, I don't get an error but I get a lot of zeroes on the screen and what may be an infinite loop.

o.K. I think I found the problem. It wasn't clearly explained. You have to enter the exponent rather then the number. E.g. enter 3 to get 1000 iterations. Have a look at the code and now it should become obvious.

I chose this because "sys.argv[0]" doesn't seem to work reliably with numbers greater 999. Consequently if it works somehow, the first output is a digit with as many zeros as requested, and that output takes a while.

Günter

edit: I just realized that I can't run the program from the command line I had to go to the program catalog <SHIFT> <1> and run it fro there
(08-18-2021 06:56 PM)Guenter Schink Wrote: [ -> ]
(08-18-2021 04:01 PM)toml_12953 Wrote: [ -> ]I had digit grouping set to 123,456.789. When I change it to 123456.789, I don't get an error but I get a lot of zeroes on the screen and what may be an infinite loop.

o.K. I think I found the problem. It wasn't clearly explained. You have to enter the exponent rather then the number. E.g. enter 3 to get 1000 iterations. Have a look at the code and now it should become obvious.

I chose this because "sys.argv[0]" doesn't seem to work reliably with numbers greater 999. Consequently if it works somehow, the first output is a digit with as many zeros as requested, and that output takes a while.

Günter

edit: I just realized that I can't run the program from the command line I had to go to the program catalog <SHIFT> <1> and run it fro there

Oof! Es tuit mir leid! Yes, an exponent of 1000 would take a long time! Thank you for replying.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
Reference URL's