Skip to content

Commit

Permalink
added the rule in simpliry for (0.0 / x ) =>0.0 and (x/0.0)=>fail
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1356 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
x02lucpo committed Nov 24, 2004
1 parent 42a3e9e commit ed12653
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modeq/exp.rml
Expand Up @@ -613,6 +613,15 @@ relation simplify_binary : (Exp, Operator, Exp, Exp) => Exp =
simplify_binary (_, MUL(ty), e1, UNARY(UMINUS(ty2),e2))
=> BINARY(e1',MUL(ty),e2')

rule is_const_zero (e1) => true
---------------------------
simplify_binary (_, DIV(ty), e1, e2) => RCONST(0.0)

rule is_const_zero (e2) => true &
Print.print_buf "# Error, division by zero.\n"
---------------------------
simplify_binary (_, DIV(ty), e1, e2) => fail

rule is_const_one (e2) => true &
simplify e1 => e1'
---------------------------
Expand Down

0 comments on commit ed12653

Please sign in to comment.