From bd7ab7794d169f7946d417af8b483c48085f45b0 Mon Sep 17 00:00:00 2001 From: AlexanderSaydakov Date: Tue, 19 Dec 2023 13:13:04 -0800 Subject: [PATCH] one slot in buffer was never used --- core/src/main/java/com/tdunning/math/stats/MergingDigest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/tdunning/math/stats/MergingDigest.java b/core/src/main/java/com/tdunning/math/stats/MergingDigest.java index 03748e2..75090a2 100644 --- a/core/src/main/java/com/tdunning/math/stats/MergingDigest.java +++ b/core/src/main/java/com/tdunning/math/stats/MergingDigest.java @@ -255,7 +255,7 @@ private void add(double x, int w, List history) { if (Double.isNaN(x)) { throw new IllegalArgumentException("Cannot add NaN to t-digest"); } - if (tempUsed >= tempWeight.length - lastUsedCell - 1) { + if (tempUsed >= tempWeight.length - lastUsedCell) { mergeNewValues(); } int where = tempUsed++;