Detect precision loss

Description

Select the diagnostic action to take when parameter precision loss occurs during simulation.

Category: Diagnostics

Settings

Default: warning

none

Simulink® software takes no action.

warning

Simulink software displays a warning.

error

Simulink software terminates the simulation and displays an error message.

Tips

  • Precision loss occurs when Simulink software encounters a parameter whose data type does not have enough precision to represent the parameter's value exactly. As a result, the modeled value differs from the ideal value.

  • Parameter precision loss differs from parameter overflow, which occurs when the range of the parameter's data type, i.e., that maximum value that it can represent, is smaller than the ideal value of the parameter.

  • Both parameter overflow and precision loss are quantization errors, and the distinction between them can be a fine one. The Detect Parameter overflow diagnostic reports all parameter quantization errors greater than one bit. For very small parameter quantization errors, precision loss will be reported rather than an overflow when

    (Max+Slope)Videal>(MinSlope)

    where

    • Max is the maximum value representable by the parameter data type.

    • Min is the minimum value representable by the parameter data type.

    • Slope is the slope of the parameter data type (slope = 1 for integers).

    • Videal is the full-precision, ideal value of the parameter.

Command-Line Information

Parameter: ParameterPrecisionLossMsg
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionerror

Related Topics