hisl_0028: Usage of Reciprocal Square Root blocks
R2026bProtect inputs of the Reciprocal Square Root block to avoid undesirable results in generated code
Usage: High-Integrity System Modeling
Guideline ID: hisl_0028
Rules
| hisl_0028: Usage of Reciprocal Square Root blocks | |
|---|---|
| A |
To support robustness of generated code, when using the Reciprocal Square Root block, protect the input from going negative. Rationale Avoid undesirable results in generated code. Verification Check usage of Reciprocal Sqrt blocks (Simulink Check) Example — Correct
|
| B |
To support robustness of generated code, when using the Reciprocal Square Root block, protect the input from going to zero. Rationale Avoid undesirable results in generated code. Verification Check usage of Reciprocal Sqrt blocks (Simulink Check) |
Tips
You can get a divide-by-zero operation, resulting in an
(Inf)output value for the reciprocal function. To avoid overflows or undefined values, protect the corresponding input from going to zero.
Industry Standards
IEC 61508-3, Table A.3 (3) 'Language subset'
IEC 61508-3, Table A.4 (3) 'Defensive programming'
IEC 62304, 5.5.3 - Software Unit acceptance criteria
ISO 26262-6, Table 1(b) 'Use of language subsets'
ISO 26262-6, Table 1(d) 'Use of defensive implementation techniques'
EN 50128, Table A.4 (11) 'Language Subset'
EN 50128, Table A.3 (1) 'Defensive Programming'
EN 50657, Table A.4 (11) 'Language Subset'
EN 50657, Table A.3 (1) 'Defensive Programming'
EN 50716, Table A.3 (1) 'Defensive Programming'
DO-331, Section MB.6.3.2.g 'Algorithms are accurate'
MISRA C:2012, Dir 4.1
MISRA C:2023, Dir 4.1
INT33-C. Ensure that division and remainder operations do not result in divide-by-zero errors
