Skip to content

Commit ce6c93b

Browse files
perostOpenModelica-Hudson
authored andcommitted
[NF] Ceval/Simplify fixes.
- Fix simplification of division, result should always be Real. - Fix ceval of integer with Integer argument. Belonging to [master]: - OpenModelica/OMCompiler#2108 - OpenModelica/OpenModelica-testsuite#822
1 parent 4df4938 commit ce6c93b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Compiler/NFFrontEnd/NFCeval.mo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ function evalBuiltinInteger
751751
output Expression result;
752752
algorithm
753753
result := match arg
754+
case Expression.INTEGER() then arg;
754755
case Expression.REAL() then Expression.INTEGER(realInt(arg.value));
755756
else algorithm printWrongArgsError(getInstanceName(), {arg}, sourceInfo()); then fail();
756757
end match;

Compiler/NFFrontEnd/NFSimplifyExp.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ algorithm
181181
case Operator.ADD() then Expression.INTEGER(i1 + i2);
182182
case Operator.SUB() then Expression.INTEGER(i1 - i2);
183183
case Operator.MUL() then Expression.INTEGER(i1 * i2);
184-
case Operator.DIV() then Expression.INTEGER(intDiv(i1, i2));
184+
case Operator.DIV() then Expression.REAL(i1 / i2);
185185
end match;
186186

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

0 commit comments

Comments
 (0)