@@ -3314,6 +3314,46 @@ algorithm
33143314 e = simplify1(DAE . BINARY (DAE . RCONST (1 . 0 ),DAE . DIV (tp2),e3));
33153315 then
33163316 e;
3317+
3318+ // (a*b)/ a = b
3319+ case (_,DAE . DIV (ty = tp),DAE . BINARY (exp1 = e1,operator = DAE . MUL (ty = _),exp2 = e2),e3)
3320+ equation
3321+ true = Expression . expEqual(e1,e3);
3322+ tp2 = Expression . typeof(e2);
3323+ e = simplify1(e2);
3324+ then
3325+ e;
3326+
3327+ // (a*b)/ b = a
3328+ /* not yet tested
3329+ case (_,DAE.DIV(ty = tp),DAE.BINARY(exp1 = e1,operator = DAE.MUL(ty = _),exp2 = e2),e3)
3330+ equation
3331+ true = Expression.expEqual(e2,e3);
3332+ tp2 = Expression.typeof(e1);
3333+ e = simplify1(e1);
3334+ then
3335+ e;
3336+ */
3337+
3338+ // (-a*b)/ a = -b
3339+ case (_,DAE . DIV (ty = tp),DAE . BINARY (exp1 = DAE . UNARY (operator = DAE . UMINUS (ty = _),exp = e1),operator = DAE . MUL (ty = _),exp2 = e2),e3)
3340+ equation
3341+ true = Expression . expEqual(e1,e3);
3342+ tp2 = Expression . typeof(e2);
3343+ e = simplify1(DAE . UNARY (DAE . UMINUS (tp2),e2));
3344+ then
3345+ e;
3346+
3347+ // (-a*b)/ b = -a
3348+ /* not yet tested
3349+ case (_,DAE.DIV(ty = tp),DAE.BINARY(exp1 = DAE.UNARY(operator = DAE.UMINUS(ty = _),exp = e1),operator = DAE.MUL(ty = _),exp2 = e2),e3)
3350+ equation
3351+ true = Expression.expEqual(e2,e3);
3352+ tp2 = Expression.typeof(e1);
3353+ e = simplify1(DAE.UNARY(DAE.UMINUS(tp2),e1));
3354+ then
3355+ e;
3356+ */
33173357
33183358 // add with 0
33193359 case (_,DAE . ADD (ty = ty),e1,e2)
0 commit comments