From c17ed80a34b124332182d9d93df4e697c59a3f84 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Fri, 12 Oct 2018 15:57:20 +0200 Subject: [PATCH] Correct off-by-one error calculating average. --- .../plugins/IobCobCalculator/IobCobCalculatorPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java index 20c8b7325d..cebc5bff66 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java @@ -146,7 +146,7 @@ public class IobCobCalculatorPlugin extends PluginBase { return false; } } - double averageDiff = totalDiff / (bgReadings.size() - 1) / 1000d; + long averageDiff = totalDiff / bgReadings.size() / 1000; boolean is5mindata = averageDiff < 1; if (L.isEnabled(L.AUTOSENS)) log.debug("Interval detection: values: " + bgReadings.size() + " averageDiff: " + averageDiff + "[s] is5minData: " + is5mindata);