Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
[NF] Ceval/Simplify fixes.
Browse files Browse the repository at this point in the history
- Fix simplification of division, result should always be Real.
- Fix ceval of integer with Integer argument.

Belonging to [master]:
  - #2108
  - OpenModelica/OpenModelica-testsuite#822
  • Loading branch information
perost authored and OpenModelica-Hudson committed Jan 12, 2018
1 parent 4df4938 commit ce6c93b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Compiler/NFFrontEnd/NFCeval.mo
Expand Up @@ -751,6 +751,7 @@ function evalBuiltinInteger
output Expression result;
algorithm
result := match arg
case Expression.INTEGER() then arg;
case Expression.REAL() then Expression.INTEGER(realInt(arg.value));
else algorithm printWrongArgsError(getInstanceName(), {arg}, sourceInfo()); then fail();
end match;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/NFFrontEnd/NFSimplifyExp.mo
Expand Up @@ -181,7 +181,7 @@ algorithm
case Operator.ADD() then Expression.INTEGER(i1 + i2);
case Operator.SUB() then Expression.INTEGER(i1 - i2);
case Operator.MUL() then Expression.INTEGER(i1 * i2);
case Operator.DIV() then Expression.INTEGER(intDiv(i1, i2));
case Operator.DIV() then Expression.REAL(i1 / i2);
end match;

case Expression.BINARY(exp1=Expression.REAL(value=r1), exp2=Expression.REAL(value=r2))
Expand Down

0 comments on commit ce6c93b

Please sign in to comment.