We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 724ef8a commit 26fd232Copy full SHA for 26fd232
1 file changed
services/opencode/src/main/kotlin/com/getcode/opencode/model/financial/Fiat.kt
@@ -180,11 +180,13 @@ data class Fiat(
180
181
// Operator overloads
182
operator fun Fiat.plus(other: Fiat): Fiat {
183
+ if (other.decimalValue == 0.0) return this
184
require(currencyCode == other.currencyCode) { "Cannot add different currencies" }
185
return Fiat(quarks = this.quarks + other.quarks, currencyCode = currencyCode)
186
}
187
188
operator fun Fiat.minus(other: Fiat): Fiat {
189
190
require(currencyCode == other.currencyCode) { "Cannot subtract different currencies" }
191
return Fiat(quarks = this.quarks - other.quarks, currencyCode = currencyCode)
192
0 commit comments