Sorting NaNs

Peter Pearson pkpearson at nowhere.invalid
Thu Jun 7 16:43:10 EDT 2018


On Thu, 07 Jun 2018 19:02:42 +1200, Gregory Ewing wrote:
> Steven D'Aprano wrote:
>> But if it were (let's say) 1 ULP greater or less 
>> than one half, would we even know?
>
> In practice it's probably somewhat bigger than 1 ULP.
> A typical PRNG will first generate a 32-bit integer and
> then map it to a float, giving a resolution coarser than
> the 52 bits of an IEEE double.
>
> But even then, the probability of getting exactly 0.5
> is only 1/2^32, which you're not likely to notice.

But gosh, if there are only 2**32 different "random" floats, then
you'd have about a 50% chance of finding a collision among any
set of 2**16 samples.  Is that really tolerable?



More information about the Python-list mailing list