DecayWeighting
Shared decay strategy for exponentially weighted stats.
Two clocks: HalfLife drives decay by wall-clock elapsed time; Alpha drives decay by cumulative observation weight. Both parameterise the family with alpha, the rate parameter used in exp(-alpha*progress) - where progress is either nanoseconds elapsed or weight accumulated depending on the clock.
Inheritors
Types
Functions
correction
Bias-correction factor 1 - exp(-alpha*w), the fraction of a running exponentially weighted mean's bias that has been "worked off" after observing cumulative weight w. Returns 0 for w = 0 to avoid 0/0 when no observations have arrived.
For a small alpha*w the closed form loses the whole value to rounding: exp(-x) is 1.0 for any x below the double epsilon, so 1 - exp(-x) is exactly 0.0 while the true correction is x. Callers divide by this, so a spurious zero reads as either NaN or a silent zero depending on which stat asks. Fall back to the first-order term, which is accurate to relative x/2 precisely where the closed form has none left.