rolling icon indicating copy to clipboard operation
rolling copied to clipboard

Summation of float values is not precise enough in the calculation of variance/std

Open ajcr opened this issue 4 years ago • 0 comments

The rolling summation of float values is not precise enough in the calculation of variance/std.

>>> import rolling
>>> list(rolling.Std([0,1,1,1], 3))
[0.5773502691896258, 7.450580596923828e-09]

The first value is correct. The second value 7.450e-09 is small, but should be 0. It is not close to 0 using the default tolerances in math.isclose() for example.

This is related to #20 which caused the variance to drop below 0 (when it should have been 0).

ajcr avatar Nov 12 '21 21:11 ajcr