You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During m2m transformation, the generator adds parentheses to arithmetic expression that had not been in the former OpenPME expression. As a result, the semantics of the arithmetic expression is changed.
This can be seen in OpenPME example of Lennard Jones.
which has no parentheses and the resulting generated code
As you can see, the 2.0 is applied to both operands of the inner minus expression.
The text was updated successfully, but these errors were encountered:
Actually, it is the opposite. The tree is created according to an equation that would use parentheses. Thus, the corresponding model is correct w.r.t. that equation that would use parentheses. If you would not create the tree according to the operator precedence the result will be different.
The problem is that the user perception is a different one as the view does not represent the resulting model if you take ordinary operator precedence and association into account.
To fix this:
the equation must include parenthesis
there must be a mapping from parenthesis of openpme.core to openpme.cpp
reduction rules for binary expressions in the generator of openpme.cpp must not create parenthesised expressions
There is a bigger usability problem which should be introduced in a different issue as you (for the time being) cannot just start writing your equation from left-to-right and the model is not constructed following the precedence rules of the operators in the whole equation. The user currently has to be carefully writing the expression.
During m2m transformation, the generator adds parentheses to arithmetic expression that had not been in the former OpenPME expression. As a result, the semantics of the arithmetic expression is changed.
This can be seen in OpenPME example of Lennard Jones.
which has no parentheses and the resulting generated code
As you can see, the 2.0 is applied to both operands of the inner minus expression.
The text was updated successfully, but these errors were encountered: