jc_0610: Operator order for multiplication and division block
Since R2020a
Guideline Publication
Control Algorithm Modeling Guidelines - Using MATLAB®, Simulink®, and Stateflow®
Sub ID Recommendations
NA-MAAB — No recommendations
JMAAB — a, b
MATLAB Versions
All
Rule
Sub ID a
The *
mark shall be used for the first input to a
multiplication and division Product block.
Not Applicable
The /
mark is used for the first input.
Sub ID b
The multiplication and division Product block shall not have more than two inputs.
Not Applicable
The block has three inputs.
Rationale
Sub ID a:
When checking the block, the input order of the expression and block is reversed, which impairs readability.
For floating point numbers, the code is generated according to the operation order in the block --
((1÷1st input)) × 2nd input
. However, if division is performed later, then the number of operations can be reduced.
Sub ID b:
The order of operations is clearly defined.
Verification
Model Advisor check: Check operator order of Product blocks (Simulink Check)
Last Changed
R2020a
Version History
Introduced in R2020a