Skip to content

Commit

Permalink
ExpressionSimplify.simplify2:
Browse files Browse the repository at this point in the history
- fixed simplifyMulJoinFactorsFind for case "e11-e12 and e12-e11, negative -1.0 factor"



git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23792 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed Dec 15, 2014
1 parent d5e5273 commit 359cc86
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Compiler/FrontEnd/ExpressionSimplify.mo
Expand Up @@ -2566,7 +2566,7 @@ algorithm
Real coeff2,coeff3,coeff;
list<tuple<DAE.Exp, Real>> res,rest;
DAE.Exp e,e2,e1;
Type tp;
DAE.Operator op;

case (_,{}) then (0.0,{});

Expand All @@ -2578,11 +2578,11 @@ algorithm
then
(coeff3,res);

case (e,((DAE.BINARY(exp1 = e1,operator = DAE.SUB(ty = tp),exp2 = e2),coeff) :: rest)) /* e11-e12 and e12-e11, negative -1.0 factor */
case (e,((DAE.BINARY(exp1 = e1,operator = op as DAE.DIV(),exp2 = e2),coeff) :: rest)) // pow(a/b,n) * pow(b/a,m) = pow(a/b,n-m)
equation
true = Expression.expEqual(e, DAE.BINARY(e2,DAE.SUB(tp),e1));
true = if Expression.isOne(e1) then Expression.expEqual(e, e2) else Expression.expEqual(e, DAE.BINARY(e2, op, e1));
(coeff2,res) = simplifyMulJoinFactorsFind(e, rest);
coeff3 = coeff - coeff2;
coeff3 = coeff2 - coeff;
then
(coeff3,res);

Expand Down

0 comments on commit 359cc86

Please sign in to comment.