Post Reply 
An unexpected result involving sums of random numbers
03-04-2023, 04:29 PM
Post: #21
RE: An unexpected result involving sums of random numbers
(03-04-2023 03:09 PM)Gil Wrote:  And Barbosa's program on EMU48, with Samsung A53:
Less than 13s in approximate mode [/php]for average "1 to 100 000 and seed =1".

Parabéns, Gérson!

Obrigado, Gil!

You can save 100000 additions by not incrementing the counter after the first RAND in each iteration. Also, local variables are evaluated faster than global variables. Try to use only the stack for more speed, especially on not emulated calculator (48G/GX and earlier). Additional optimization in the main loop would make it a bit faster.

It appears iHP48 emulates the HP-48GX faster than the HP50g:

« 0 DUP2 NOT SWAP
START RAND
DO RAND + SWAP 1 + SWAP DUP
UNTIL 1 >
END DROP
NEXT SWAP / 1 +
»

'X' STO

« TIME 1 RDZ 100000 X TIME ROT HMS-
»

EVAL

->

2: 2.71959
1: 0.00153468
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: An unexpected result involving sums of random numbers - Gerson W. Barbosa - 03-04-2023 04:29 PM



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