Documentation Center

  • Trial Software
  • Product Updates

Contents

jc_0481: Use of hard equality comparisons for floating point numbers in Stateflow

ID: Title

jc_0481: Use of hard equality comparisons for floating point numbers in Stateflow®

Priority

Recommended

Scope

MAAB

MATLAB Versions

All

Prerequisites

None

Description

  • Do not use hard equality comparisons (Var1 == Var2) with two floating-point numbers.

  • If a hard comparison is required, a margin of error should be defined and used in the comparison (LIMIT, in the example).

  • Hard equality comparisons may be done between two integer data types.

Correct

Incorrect

Rationale

  • Verification and Validation

  • Code Generation

Last Changed

V2.0

Model Advisor Check

By Task > Modeling Standards for MAAB > Stateflow > Check for equality operations between floating-point expressions in Stateflow charts

Was this topic helpful?