Post Reply 
Numworks - strange random numbers
03-06-2023, 11:27 PM
Post: #8
RE: Numworks - strange random numbers
(03-23-2020 04:34 PM)Albert Chan Wrote:  LN(2) = 2 * probability of integer part of RND/RND is odd

> sum(rem(floor(random()/random()),2),k,1,10000) / 5000

2
0
2
...

We expected around log(2) = 0.6931, but getting 0 or 2 only.
It seems argument inside sum is evaluated only once.

random(), and its cousins, should not be treated as normal function.
It should never be optimized away.

Unfortunately, it seems Numworks fix is like whack-a-mole game.
Example, from github fixed issues: random()-random() gets simplified to 0

Above expression, replacing floor(x) = round(x-0.5) work.

> sum(rem(round(random()/random()-0.5),2),k,1,10000) / 5000

0.7034
0.6998
0.6938
...
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Numworks - strange random numbers - Albert Chan - 03-06-2023 11:27 PM



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