Main Content

Remove code from floating-point to integer conversions with saturation that maps NaN to zero

Control generation of protective code that handles floating-point to integer conversion for NaN values

Model Configuration Pane: Code Generation / Optimization

Description

The Remove code from floating-point to integer conversions with saturation that maps NaN to zero parameters instructs the code generator to remove code that handles floating-point to integer conversion results for NaN values.

Dependencies

For ERT-based targets, this parameter is enabled when you select the floating-point numbers and non-finite numbers check boxes in the Code Generation > Interface pane.

Settings

on (default) | off
On

Removes code when mapping from NaN to integer zero occurs. Select this check box if code efficiency is critical to your application and the following conditions are true for at least one block in the model:

  • Computing outputs or parameters of a block involves converting floating-point data to integer or fixed-point data.

  • The Saturate on integer overflow check box is selected in the Block Parameters dialog box.

Caution

Execution of generated code might not produce the same results as simulation.

Off

Results for simulation and execution of generated code match when mapping from NaN to integer zero occurs. The generated code is larger than when you select this check box.

Tips

  • Selecting this check box reduces the size and increases the speed of the generated code at the cost of producing results that do not match simulation in the case of NaN values.

  • Selecting this check box affects code generation results only for NaN values and cannot cause code generation results to differ from simulation results for other values.

Recommended Settings

ApplicationSetting
DebuggingOff
TraceabilityOff
EfficiencyOn
Safety precautionNo recommendation

Programmatic Use

Parameter: EfficientMapNaN2IntZero
Type: character vector
Value: 'on' | 'off'
Default: 'on'

Version History

Introduced in R2008b