Merge pull request #208 from AlbertoPellitteri/fix-mod-wrong-result

Fix percentage calculation after mod result
This commit is contained in:
Tibor Kaputa 2021-11-03 22:54:14 +01:00 committed by GitHub
commit 7b949804e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -228,6 +228,10 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
val partial = baseValue / (100 / secondValue)
baseValue.minus(partial)
}
PERCENT -> {
val partial = (baseValue % secondValue) / 100
partial
}
else -> baseValue / (100 * secondValue)
}
}