Main Content

hisl_0003: Usage of square root operations

R2026b

To support robustness of generated code, when using the Square Root operations

Usage: High-Integrity System Modeling

Guideline ID: hisl_0003

Rules

hisl_0003: Usage of square root operations
A

Account for complex numbers as the output.

Rationale

Avoid undesirable results in generated code.

Verification

Check usage of square root operations (Simulink Check)

Example — Correct

Square Root block with Output Data set to Complex handles negative input -100 by producing complex output 0 + 10i.

Simulink model with Constant -100 feeding a Square Root block with Output Data set to Complex, producing output 0 + 10i

B

Protect the input from going negative.

Rationale

Avoid undesirable results in generated code.

Verification

Check usage of square root operations (Simulink Check)

Example — Correct

Abs block placed before the Square Root block protects the input from going negative, producing a real-valued output of 10.

Simulink model with Constant -100 feeding an Abs block then a Square Root block, producing output 10

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

Version History

Introduced in R2010a

expand all