From 9acdc3bb5736f876c69dec51380580a4aadef201 Mon Sep 17 00:00:00 2001 From: bajb Date: Fri, 1 Apr 2016 14:52:34 +0100 Subject: Specifically check for 0 in division to allow for negative operations --- src/NXP/Classes/Token/TokenDivision.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/NXP/Classes/Token') diff --git a/src/NXP/Classes/Token/TokenDivision.php b/src/NXP/Classes/Token/TokenDivision.php index 7e55640..f1c35ff 100644 --- a/src/NXP/Classes/Token/TokenDivision.php +++ b/src/NXP/Classes/Token/TokenDivision.php @@ -47,7 +47,7 @@ class TokenDivision extends AbstractOperator { $op2 = array_pop($stack); $op1 = array_pop($stack); - $result = $op2->getValue() > 0 ? $op1->getValue() / $op2->getValue() : 0; + $result = $op2->getValue() != 0 ? $op1->getValue() / $op2->getValue() : 0; return new TokenNumber($result); } -- cgit v1.2.3