Main Content

Detect precision loss

Diagnostic action to take if the software detects parameter precision loss

Model Configuration Pane: Diagnostics / Data Validity

Description

The Detect precision loss parameter specifies the diagnostic action to take if the software detects parameter precision loss. Precision loss occurs when the data type of a parameter does not have enough precision to represent the parameter value exactly. As a result, the value of the parameter in the model differs from the ideal value.

Both parameter precision loss and parameter overflow are quantization errors. While parameter precision loss differs from parameter overflow, the distinction can be nuanced. Parameter precision loss occurs when the ideal parameter value is within the range of the data type and scaling, but the data type does not have an exact representation of the parameter value.

The Detect overflow diagnostic reports all quantization errors greater than the specified Bits of error threshold, which has a default setting of one bit. For very small parameter quantization errors and when the Bits of error threshold is set to One bit, precision loss is reported rather than an overflow when:

(Max+Slope)Videal>(MinSlope)

where:

  • Max is the maximum value the parameter data type can represent.

  • Min is the minimum value the parameter data type can represent.

  • Slope is the slope of the parameter data type. For integers, the slope is 1.

  • Videal is the ideal value of the parameter.

Settings

warning (default) | error | none
warning

The software issues a warning if the software detects parameter precision loss.

error

The software issues an error and terminates the simulation if the software detects parameter precision loss.

none

The software does not issue a diagnostic if the software detects precision loss.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionerror

Programmatic Use

Parameter: ParameterPrecisionLossMsg
Type: string | character vector
Value: "none" | "warning" | "error"
Default: "warning"

Version History

Introduced before R2006a