It failed a very basic test, comparing a few integer inputs against the brute force calculations, even though I was only looking for accuracy within two decimal places.
I tried using these inputs with a buffer size of 6, it will fail on update(samples[19]) when all six values are now 6:
const samples [ 1, 2, 3,3,3,
4,4,4,4,
5,5,5,5,5,
6,6,6,6,6,6
6,6,6,6,6]
I "fixed" it by resetting the value of dSquared to actual zero when "too close" to zero
if(Math.abs(this._dSquared) < 0.000_000_000_001) { this._dSquared = 0 }