commit 5e8eda4c96cddc316a4903a8017dcaa334d11c22
parent bd89805251278c1fa306f411eba6d3f00b86f846
Author: Marc Stibane <marc@taler.net>
Date: Thu, 18 Jan 2024 00:01:49 +0100
fix fractions
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/taler-swift/Sources/taler-swift/Amount.swift b/taler-swift/Sources/taler-swift/Amount.swift
@@ -251,7 +251,7 @@ public final class Amount: Codable, Hashable, @unchecked Sendable, CustomStringC
public init(currency: String, cent: UInt64) {
self.currency = currency
self.integer = cent / 100 // For existing currencies, fractional digits could be 0, 2 or 3
- self.fraction = UInt32(cent - (self.integer * 100))
+ self.fraction = UInt32(cent - (self.integer * 100)) * (Self.fractionalBase() / 100)
}
/// Initializes an amount from a decoder.