Merge pull request #167 from TouchInstinct/amount-with-decimal-decorator-round
amount with decimal decorator round
This commit is contained in:
commit
468b1ef820
|
|
@ -8,6 +8,7 @@ import kotlin.math.abs
|
|||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
import kotlin.math.pow
|
||||
import kotlin.math.roundToLong
|
||||
|
||||
class AmountWithDecimalDecorator(
|
||||
val editText: EditText,
|
||||
|
|
@ -214,8 +215,7 @@ class AmountWithDecimalDecorator(
|
|||
return formatter.format(this.replaceSeparatorsToDot().toDouble().floor())
|
||||
}
|
||||
|
||||
private fun Double.floor() =
|
||||
(this * 10.toDouble().pow(decimalPartLength)).toLong() / 10.toDouble()
|
||||
.pow(decimalPartLength)
|
||||
// TODO make it simple
|
||||
private fun Double.floor() = (this * 10f.pow(decimalPartLength)).roundToLong() / 10f.pow(decimalPartLength)
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue