Merge pull request #230 from Aga-C/fix-percentage

Fixed large number percentage error (#228)
This commit is contained in:
Tibor Kaputa 2021-12-29 21:52:03 +01:00 committed by GitHub
commit 3352fab92e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -224,7 +224,7 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
// handle cases like 10%200 here
val result = if (sign == "%") {
val second = secondValue / 100f
ExpressionBuilder("${baseValue.format()}*${second.format()}").build().evaluate()
ExpressionBuilder("${baseValue.format().replace(",", "")}*${second.format()}").build().evaluate()
} else {
ExpressionBuilder(expression.replace(",", "")).build().evaluate()
}