Skip to content

Commit 56ceced

Browse files
authored
[LOOP-4414] corrected detection of decimal precision required (#545)
1 parent 8f6efe7 commit 56ceced

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

WatchApp Extension/Views/Carb Entry & Bolus/BolusInput.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ fileprivate extension Collection where Element == Decimal {
102102
/// - Precondition: The collection is sorted in ascending order.
103103
func deltaScale(boundedBy maxScale: Int) -> Int {
104104
let roundedToMaxScale = lazy.map { $0.rounded(toPlaces: maxScale) }
105-
guard let maxDelta = roundedToMaxScale.adjacentPairs().map(-).map(abs).max() else {
105+
guard let minDelta = roundedToMaxScale.adjacentPairs().map(-).map(abs).min() else {
106106
return 0
107107
}
108108

109-
return abs(Swift.min(maxDelta.exponent, 0))
109+
return abs(Swift.min(minDelta.exponent, 0))
110110
}
111111
}

0 commit comments

Comments
 (0)