Opened 19 years ago

Last modified 19 years ago

#70 closed defect (fixed)

The equation simplification applied when flattening has some problems.

Reported by: Adrian Pop Owned by: Adrian Pop
Priority: critical Milestone:
Component: Version:
Keywords: Cc: Adrian Pop, Adrian Pop

Description


Change History (3)

comment:1 by Adrian Pop, 19 years ago

Part of the bug reported by Atya El-Shekh:
(I cannot reproduce the fact that omc generates different code for
different platforms, so here is only the simplification part of the bug)

model BugTest

Real x;
Real y;
parameter Real n=1.95;

equation

x = 2(n-1) / (0.3(n-1));
y = (2/0.3)(n-1) - 1;

end BugTest;

Compiling the above model on linux gives the following output:
$ omc +s BugTest.mo
fclass BugTest

Real x;
Real y;
parameter Real n = 1.95;

equation

x = 2.0 (n - 1.0) * 0.3 (-n - 1.0);
y = 6.66666666666667 (n - 1.0) - 1.0;

end BugTest;

The simplified expression for x is wrong. (-n - 1.0) should be ( -n + 1.0).

Adrian/

comment:2 by Adrian Pop, 19 years ago

Actually I think the result is OK and the print of expression is wrong!

comment:3 by Adrian Pop, 19 years ago

Fixed in SVN revision 2373.
Actually the printing of expressions was wrong.

Note: See TracTickets for help on using tickets.