Skip to content

Commit

Permalink
Fixed Exp.makeSum so that it works correctly if the second expression…
Browse files Browse the repository at this point in the history
… is zero.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@4774 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Jan 14, 2010
1 parent 44b7e3c commit 30d21f6
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions Compiler/Exp.mo
Expand Up @@ -2374,6 +2374,7 @@ algorithm
local
Exp e,e_1,e1;
list<Exp> es;
Type tp;
case ({}) then {};
case ({e}) then {e};
case ((e1 :: es))
Expand Down Expand Up @@ -3752,14 +3753,28 @@ algorithm
Ident str;
case ({}) then DAE.RCONST(0.0);
case ({e1}) then e1;
case ({e1,e2})
case ({e1, e2})
equation
true = isZero(e1);
then e2;
case ({e1, e2})
equation
true = isZero(e2);
then e1;
case ({e1, e2})
equation
tp = typeof(e1) "Take type info from e1, ok since type checking already performed." ;
then DAE.BINARY(e1, DAE.ADD(tp), e2);
//res = DAE.BINARY(e1, DAE.ADD(tp), e2);
//then res;
/*case ({e1,e2})
equation
b1 = isZero(e1);
tp = typeof(e1) "Take type info from e1, ok since type checking already performed." ;
res = DAE.BINARY(e1,DAE.ADD(tp),e2);
res = Util.if_(b1,e2,res);
then
res;
res;*/
case ((e1 :: rest))
equation
b1 = isZero(e1);
Expand Down

0 comments on commit 30d21f6

Please sign in to comment.