himl_0008: MATLAB code relational operator data types
R2026bUse the same data type for left and right operands of relational operators
Usage: High-Integrity System Modeling
Guideline ID: himl_0008
Rules
| himl_0008: MATLAB® code relational operator data types |
|---|
For MATLAB code with relational operators, use the same data type for the left and right operands. Rationale
Verification Check usage of relational operators in MATLAB Function blocks (Simulink Check) Example — Correct
Example — Incorrect
|
Tips
If the two operands have different data types, MATLAB will promote both operands to a common data type. This can lead to unexpected results.
Industry Standards
DO-331, Section MB.6.3.1.g 'Algorithms are accurate'
DO-331, Section MB.6.3.2.g 'Algorithms are accurate'
IEC 61508-3, Table A.3 (2) 'Strongly typed programming language'
EC 61508-3, Table A.3 (3) 'Language subset'
IEC 62304, 5.5.3 - Software Unit acceptance criteria
ISO 26262-6, Table 1(1b) 'Use of language subsets'
ISO 26262-6, Table 1(1c) 'Enforcement of strong typing'
ISO 26262-6, Table 6 (1g) 'No implicit type conversions'
EN 50128, Table A.4 (8) 'Strongly Typed Programming Language'
EN 50128, Table A.4 (11) 'Language Subset'
EN 50657, Table A.4 (8) 'Strongly Typed Programming Language'
EN 50657, Table A.4 (11) 'Language Subset'