From 2e8a2d4b2ea0366e7723ec76dc3b15f7874163fa Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Mon, 1 Nov 2010 10:03:50 +0000 Subject: [PATCH] Bug fix in integer power type checking. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@2205 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/parser/ast/ExpressionFunc.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prism/src/parser/ast/ExpressionFunc.java b/prism/src/parser/ast/ExpressionFunc.java index 3aece49a..5ac01bbc 100644 --- a/prism/src/parser/ast/ExpressionFunc.java +++ b/prism/src/parser/ast/ExpressionFunc.java @@ -253,7 +253,7 @@ public class ExpressionFunc extends Expression double base = getOperand(0).evaluateDouble(ec); double exp = getOperand(1).evaluateDouble(ec); // Not allowed to do e.g. pow(2,-2) because of typing (should be pow(2.0,-2) instead) - if (type instanceof TypeInt || (exp < 0)) + if (type instanceof TypeInt && (exp < 0)) throw new PrismLangException("Negative exponent not allowed for integer power", this); double res = Math.pow(base, exp); if (type instanceof TypeInt) {