bluesmoon / node-faststats

Quickly calculate statistics of a running stream of data
https://npmjs.org/package/fast-stats
Other
192 stars 19 forks source link

Bug in shift() #3

Closed VRMink closed 11 years ago

VRMink commented 11 years ago

This will cause the library to hang.

var Stats = require('fast-stats').Stats;
var s = new Stats();
s.push(0,10);
s.shift();
VRMink commented 11 years ago

The problem is that shifting from 2 to 1 data point will cause the _del_cache function to recalculate the statistics on the assumption that there are atleast to data points in the array, which is not valid.