mirror of
https://github.com/SimpleMobileTools/Simple-Calculator.git
synced 2025-02-21 14:00:56 +01:00
[Bug] NaN error #54
This commit is contained in:
parent
67894925ad
commit
eed466ed05
@ -119,6 +119,9 @@ class CalculatorImpl(calculator: Calculator, val context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun handleClear() {
|
fun handleClear() {
|
||||||
|
if (displayedNumber.equals(NAN)) {
|
||||||
|
handleReset()
|
||||||
|
} else {
|
||||||
val oldValue = displayedNumber
|
val oldValue = displayedNumber
|
||||||
var newValue = "0"
|
var newValue = "0"
|
||||||
val len = oldValue!!.length
|
val len = oldValue!!.length
|
||||||
@ -135,6 +138,7 @@ class CalculatorImpl(calculator: Calculator, val context: Context) {
|
|||||||
setValue(newValue)
|
setValue(newValue)
|
||||||
mBaseValue = Formatter.stringToDouble(newValue)
|
mBaseValue = Formatter.stringToDouble(newValue)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun handleReset() {
|
fun handleReset() {
|
||||||
resetValues()
|
resetValues()
|
||||||
|
@ -13,6 +13,7 @@ val DECIMAL = "decimal"
|
|||||||
val CLEAR = "clear"
|
val CLEAR = "clear"
|
||||||
val RESET = "reset"
|
val RESET = "reset"
|
||||||
|
|
||||||
|
val NAN = "NaN"
|
||||||
val ZERO = "zero"
|
val ZERO = "zero"
|
||||||
val ONE = "one"
|
val ONE = "one"
|
||||||
val TWO = "two"
|
val TWO = "two"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user