Browse Source

Bug fix in integer power type checking.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@2205 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 15 years ago
parent
commit
2e8a2d4b2e
  1. 2
      prism/src/parser/ast/ExpressionFunc.java

2
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) {

Loading…
Cancel
Save