From 02899b863bee91bb616b6779636b65d261cc1e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Mon, 10 Sep 2018 13:28:38 +0200 Subject: [PATCH] [poincare] Median computation (and quartile...) tackles imprecision --- apps/statistics/store.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/statistics/store.cpp b/apps/statistics/store.cpp index d605b1b25..086d6af08 100644 --- a/apps/statistics/store.cpp +++ b/apps/statistics/store.cpp @@ -249,7 +249,7 @@ double Store::sortedElementAtCumulatedFrequency(int series, double k, bool creat memcpy(bufferValues, m_data[series][0], numberOfPairsOfSeries(series)*sizeof(double)); int sortedElementIndex = 0; double cumulatedFrequency = 0.0; - while (cumulatedFrequency < k) { + while (cumulatedFrequency < k-DBL_EPSILON) { sortedElementIndex = minIndex(bufferValues, numberOfPairsOfSeries(series)); bufferValues[sortedElementIndex] = DBL_MAX; cumulatedFrequency += m_data[series][1][sortedElementIndex] / totalNumberOfElements;