NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
▲Counting large numbers of events in small floating point registers (dotat.at)
dsamarin 18 hours ago [-]
It looks like Corollary 6 in the original paper gives us a way to compute an unbiased estimate of the variance directly from the counter in constant time, without any additional storage.

With s = 2^max(0, e-1), variance = MANTISSA * (s-1) * (s-2) / 3 + m * s * (s-1)

This could make for a nice companion function to unpack(), and potentially serve as a starting point for constructing confidence intervals.

https://arxiv.org/pdf/0904.3062

dsamarin 18 hours ago [-]
The bump function might have a tiny bias when the RNG returns 0 and the exponent is positive, so we can update the return to `approx + (r == 0 || z >= e)`.
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 10:04:12 GMT+0000 (Coordinated Universal Time) with Vercel.