Historical forum-msg-id-133953-edit, Revision 1

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

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

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu