2 comments

  • dsamarin 3 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 3 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)`.