Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit d0b89b8

Browse files
committed
1 parent 25cc109 commit d0b89b8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

biz/obsolete/src/main/kotlin/io/goooler/demoapp/obsolete/util/ObsoleteExtensions.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import io.reactivex.rxjava3.core.Observable
1111
import io.reactivex.rxjava3.core.Single
1212
import io.reactivex.rxjava3.schedulers.Schedulers
1313
import java.math.BigDecimal
14+
import java.math.RoundingMode
1415
import java.util.Calendar
1516
import java.util.Date
1617
import kotlin.math.absoluteValue
@@ -94,13 +95,13 @@ fun Number.formatMoney(isYuan: Boolean = false, trans2W: Boolean = false, scale:
9495
when {
9596
trans2W && moneyF / 10000 > 0 -> {
9697
BigDecimal.valueOf(moneyF / 10000)
97-
.setScale(1, BigDecimal.ROUND_DOWN)
98+
.setScale(scale, RoundingMode.DOWN)
9899
.stripTrailingZeros().toPlainString() + "W"
99100
}
100101

101102
else ->
102103
BigDecimal.valueOf(moneyF)
103-
.setScale(scale, BigDecimal.ROUND_DOWN)
104+
.setScale(scale, RoundingMode.DOWN)
104105
.stripTrailingZeros().toPlainString()
105106
.let {
106107
if (it.toDouble().absoluteValue < 0.000001) {

0 commit comments

Comments
 (0)