mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
fix for NaN occurring with small values
This commit is contained in:
parent
080849ba3d
commit
af5955e108
@ -51,8 +51,10 @@ public final class StatBucket {
|
||||
} else {
|
||||
var meanIncrement = (value - popped) / ringbuf.count();
|
||||
var newMean = mean + meanIncrement;
|
||||
|
||||
var dSquaredIncrement = ((value - popped) * (value - newMean + popped - mean));
|
||||
// If this value is too small to be interpreted as a double it gets converted to
|
||||
// zero, which is not what we want. So we use the smallest possible double value
|
||||
if (dSquaredIncrement == 0) dSquaredIncrement = Double.MIN_VALUE;
|
||||
var newDSquared = this.dSquared + dSquaredIncrement;
|
||||
mean = newMean;
|
||||
dSquared = newDSquared;
|
||||
|
Loading…
Reference in New Issue
Block a user