mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-18 16:25:27 +02:00
fix(evaluator)!: Throw exception when trying to do 0^0
Signed-off-by: Myzel394 <50424412+Myzel394@users.noreply.github.com>
This commit is contained in:
parent
6a5efe92ba
commit
84ddb6b6fa
@ -216,7 +216,13 @@ class Expression(
|
|||||||
|
|
||||||
// Power
|
// Power
|
||||||
if (moveIfMatched(Token.Operator.power)) {
|
if (moveIfMatched(Token.Operator.power)) {
|
||||||
expr = expr.pow(parseFactor())
|
val factor = parseFactor()
|
||||||
|
|
||||||
|
if (factor.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
throw ExpressionException.BadExpression()
|
||||||
|
}
|
||||||
|
|
||||||
|
expr = expr.pow(factor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modulo
|
// Modulo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user