Updated on 2026-08-14

This commit is contained in:
Tangem 2023-12-01 12:17:23 +03:00
commit c72f7969ea
3 changed files with 3 additions and 3 deletions

View file

@ -29,8 +29,8 @@ class CurrencyConverter(
fun toCrypto(fiat: BigDecimal): BigDecimal {
if (fiat.isZero()) return fiat
val scaledRateValue = rateValue.setScale(decimals, roundingMode)
val scaledFiat = fiat.setScale(decimals, roundingMode)
return scaledFiat.divide(scaledRateValue, RoundingMode.UP)
val fiatValue = fiat.setScale(rateValue.scale(), RoundingMode.UP)
val cryptoValue = fiatValue.divide(rateValue, RoundingMode.UP)
return cryptoValue.setScale(decimals, roundingMode)
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Before After
Before After