Re: Smallest Non-Zero Number from rnd()

new topic     » goto parent     » topic index » view thread      » older message » newer message
irv said...
euphoric said...

What is the smallest non-zero number that rnd() will return?

Perhaps I'm misunderstanding the question, but a test shows me that rnd() can return numbers smaller than 0.01:

include std/rand.e 
atom x 
while 1 do 
x = rnd()  
if x < 0.001 then ? x end if 
end while 

0.0006218517863 
0.0009995880243 
0.0002405867837 
0.000242709016 
0.0004686160389 
0.0007781575098 
0.0003000935483 

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? smile

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!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu