3 ms·
What you propose is similar to generating an integer in {0, 1, ..., 2^k - 1} and dividing by 2^k. This is not the same as drawing a uniformly random real number
by fdej 12y ago
What you propose is similar to generating an integer in {0, 1, ..., 2^k - 1} and dividing by 2^k. This is not the same as drawing a uniformly random real number and rounding to the nearest floating-point number. The original link addresses exactly this problem.
- chockablock 12y ago>What you propose is similar to... No, it's not. See the linked paper. In IEEE754, the interval [1,2) is special.
- fdej 12y agoIf you generate a random double-precision floating-point number in [1,2) and subtract 1, you will never generate 2^-100. A correct algorithm will be able to generate 2^-100 (with very small probability!)
- chockablock 12y agoI'm not making claims about the correctness of the approach (I'm not enough of an FP math whiz); I was just pointing out that your original critique appeared to be based on a misunderstanding.
- deleted 12y ago[deleted]
- chocka_oops 12y agoSorry--chockablock here. I misunderstood your argument and see that you were correct and also that your follow-up was on-subject (see: not a whiz). I'd delete but have noprocrast set.