Fix Division Operation

This commit is contained in:
Vyas Nellutla 2020-07-16 09:19:10 -05:00
parent 0a31ad06ea
commit 673efc8e00
No known key found for this signature in database
GPG key ID: B20BCF5A38C1E088

View file

@ -3,6 +3,7 @@ package com.simplemobiletools.calculator.operation
import com.simplemobiletools.calculator.operation.base.BinaryOperation
import com.simplemobiletools.calculator.operation.base.Operation
import java.math.BigDecimal
import java.math.MathContext.DECIMAL128
class DivideOperation(baseValue: BigDecimal, secondValue: BigDecimal) : BinaryOperation(baseValue, secondValue), Operation {
@ -10,7 +11,7 @@ class DivideOperation(baseValue: BigDecimal, secondValue: BigDecimal) : BinaryOp
return if (secondValue.compareTo(BigDecimal.ZERO) == 0) {
BigDecimal.ZERO
} else {
baseValue.divide(secondValue)
baseValue.divide(secondValue, DECIMAL128)
}
}
}