Updated on 2026-08-14
This commit is contained in:
commit
c72f7969ea
3 changed files with 3 additions and 3 deletions
|
|
@ -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 |
Binary file not shown.
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 90 KiB |
Loading…
Add table
Add a link
Reference in a new issue