Some math(s) expressions are calulated incorrectly

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Some math(s) expressions are calulated incorrectly

Post by Steve »

This is an error within simulation only. The error does not occur with programs running in the microcontroller.

The order of precedence of mathematical expressions within calculation, decision and loop icons is not totally correct when simulating a program. The precedence of *, / and MOD is higher than + and -, but + and - share the same precedence as other operators such as "<" and "&&".

This is not correct: "+" and "-" should be of a higher precedence.

To work around this problem, make sure you use parentheses (brackets) to make the calculation's meaning explicit.

Post Reply