#2364 closed defect (fixed)
Math order of operations changes after file save
Reported by: | anonymous | Owned by: | Adeel Asghar |
---|---|---|---|
Priority: | critical | Milestone: | 1.9.4 |
Component: | OMEdit | Version: | trunk |
Keywords: | Cc: |
Description
When writing an equation in OMEdit and using parenthesis to dictate the desired order of operations, the equation is changed after file save. When the following formula is evaluated in OMShell just as it is typed here:
hl:=f*(pipelength/(pipediameter/12))*((vin2)/(2*g))
37.77689569419355
The correct answer is given. When the same formula is saved in OMShell, some of the parenthesis are removed which changes the order of evaluation. The result after the file save is:
hl = f * pipelength / pipediameter / 12 * vin 2 / (2 * g)
Which, when copied to OMShell and evaluated gives the following:
hl := f * pipelength / pipediameter / 12 * vin 2 / (2 * g)
0.26233955343189963
Which is clearly the wrong answer.
Change History (10)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
You can surround the text with 3 accolade parentheses on both sides to keep it exactly as it is, no wiki formatting, i.e. exactly as you type formatted text
.
comment:4 by , 10 years ago
Milestone: | 1.9.1 → 1.9.2 |
---|
This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).
comment:5 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:7 by , 9 years ago
Status: | new → accepted |
---|
This issue has now been fixed in a development branch https://github.com/adeas31/OMEdit/tree/indentation for OpenModelica 1.9.4 final release.
comment:8 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
The fix is now available via the nightly build.
Replying to anonymous:
The above formulas looked correct when I pasted them into the comments window, but the formatting looks different when viewing the submitted ticket. it appears that saving the model file is changing the intended formula from (vin2)/(2*g) to vin(2/(2*g))