Wiki Diff forum-msg-id-133953-edit, revision #1 to tip

Original date:2019-06-10 16:46:46
Original date:2019-06-10 16:41:22
Edited by: euphoric
Subject: Re: Smallest Non-Zero Number from rnd()

[quote irv]
[quote euphoric]
What is the smallest non-zero number that rnd() will return?
[/quote]

Perhaps I'm misunderstanding the question, but a test shows me that rnd() can return numbers smaller than 0.01:
<eucode>
include std/rand.e
atom x
while 1 do
x = rnd()
if x < 0.001 then ? x end if
end while
</eucode>

{{{
0.0006218517863
0.0009995880243
0.0002405867837
0.000242709016
0.0004686160389
0.0007781575098
0.0003000935483
}}}

[/quote]

Oh, nice! I guess my testing wasn't thorough enough. I never saw any numbers that small.

The question remains, what is the smallest? I'd have to guess it's going to be as precise as the highest decimal point, so maybe 0.0000000000001? :-)

Although, from your test, it looks like 0.0001 will be the smallest.

ADD: Just did a test, and I'm getting numbers lower than 0.0000001! Wowie!

Search



Quick Links

User menu

Not signed in.

Misc Menu