mirror of
https://github.com/SimpleMobileTools/Simple-Calculator.git
synced 2025-05-03 11:18:44 +02:00
fix #196, properly handle NaN values
This commit is contained in:
parent
28160884fd
commit
549172021c
@ -112,7 +112,7 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
|
|||||||
// handle percents manually, it doesn't seem to be possible via net.objecthunter:exp4j. "%" is used only for modulo there
|
// handle percents manually, it doesn't seem to be possible via net.objecthunter:exp4j. "%" is used only for modulo there
|
||||||
private fun handlePercent() {
|
private fun handlePercent() {
|
||||||
var result = calculatePercentage(baseValue, getSecondValue(), lastOperation)
|
var result = calculatePercentage(baseValue, getSecondValue(), lastOperation)
|
||||||
if (result == Double.POSITIVE_INFINITY || result == Double.NEGATIVE_INFINITY) {
|
if (result.isInfinite() || result.isNaN()) {
|
||||||
result = 0.0
|
result = 0.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user