Skip to content

Commit

Permalink
- added rule
Browse files Browse the repository at this point in the history
 a - (-b)*c = a + b*c



git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20606 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed May 14, 2014
1 parent 65da2d6 commit 8849a08
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Compiler/FrontEnd/ExpressionSimplify.mo
Expand Up @@ -3877,6 +3877,10 @@ algorithm
// a-(-b) = a+b
case (_,DAE.SUB(ty = ty),e1,DAE.UNARY(operator = DAE.UMINUS(ty = _),exp = e2),_,_)
then DAE.BINARY(e1,DAE.ADD(ty),e2);

// a-(-b)*c = a+b*c
case (_,DAE.SUB(ty = ty),e1,DAE.BINARY(DAE.UNARY(operator = DAE.UMINUS(ty = _),exp = e2),op1 as DAE.MUL(_),e3),_,_)
then DAE.BINARY(e1,DAE.ADD(ty),DAE.BINARY(e2,op1,e3));

// 0 / x = 0
case (_,DAE.DIV(ty=_),e1,e2,true,false)
Expand Down

0 comments on commit 8849a08

Please sign in to comment.