Random double

qznc qznc at go.to
Wed Apr 24 06:02:17 PDT 2013


On Wednesday, 24 April 2013 at 06:56:44 UTC, Ivan Kazmenko wrote:
> On Wednesday, 24 April 2013 at 06:37:50 UTC, qznc wrote:
>> It also raises the question what uniform means in the context 
>> of floating point. Uniform over the numbers or uniform over
>> the bit patterns?
>
> I'd like to mention that there's no such mathematical object as 
> "uniform distribution on [0..+infinity)".  On the other hand, a 
> (discrete) uniform distribution of the bit pattern, or 
> restricted bit pattern (that is, no special values), is of 
> course valid.  A "random positive double" as a bit pattern most 
> closely resembles exponential distribution I think.

Of course not, since infinity is not a number.

However, double.max is not infinity, but 0x1p+1024. See 
http://dlang.org/d-floating-point.html


More information about the Digitalmars-d-learn mailing list