فهرست منبع

Fix rounding to be consistent with JS for deviation

Sam King 5 ماه پیش
والد
کامیت
caf3214adb
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      Trio/Sources/APS/OpenAPSSwift/DetermineBasal/DetermineBasalGenerator.swift

+ 3 - 3
Trio/Sources/APS/OpenAPSSwift/DetermineBasal/DetermineBasalGenerator.swift

@@ -207,11 +207,11 @@ enum DeterminationGenerator {
 
 
         let intervals: Decimal = 6 // 30 / 5
         let intervals: Decimal = 6 // 30 / 5
 
 
-        var deviation = (intervals * (minDelta - currentGlucoseImpact)).rounded(toPlaces: 0)
+        var deviation = (intervals * (minDelta - currentGlucoseImpact)).jsRounded()
         if deviation < 0 {
         if deviation < 0 {
-            deviation = (intervals * (minAvgDelta - currentGlucoseImpact)).rounded(toPlaces: 0)
+            deviation = (intervals * (minAvgDelta - currentGlucoseImpact)).jsRounded()
             if deviation < 0 {
             if deviation < 0 {
-                deviation = (intervals * (longAvgDelta - currentGlucoseImpact)).rounded(toPlaces: 0)
+                deviation = (intervals * (longAvgDelta - currentGlucoseImpact)).jsRounded()
             }
             }
         }
         }