[erlang-questions] Limits on integer size

Imre Palik <>
Tue Aug 26 10:26:26 CEST 2008


From: "Bjorn Gustavsson" <>

> >
> > But if I decrease the size of HN to let's say 100 digits, then it works
> > without any problem.
> > Could somebody tell me the limitations that I have with integers in erlang?
> >  Is it possible to tune these somehow (config file, environment variable,
> > etc.)?
> >
>
> The problem is not integer limits, but floating point limits.
>
> random:uniform(N) first generates a floating point number between 0 and 1,
> then multiplies it by N. The result is too big to be represented
> as a floating point number.

Does this also means, that even with a range where it seems to work, some values will never be returned, because of the gaps in the floating point representation?

How many bits of randomness can I expect with a call to random:uniform(N)?

ImRe



More information about the erlang-questions mailing list