Main Content

Use memset to initialize floats and doubles to 0.0

Description

Specify whether to generate code that explicitly initializes floating-point data to 0.0.

Category: Optimization

Settings

Default: On (GUI), 'off' (command line)

On

Uses memset to clear internal storage for floating-point data to integer bit pattern 0 (all bits 0), regardless of type. If your compiler and target CPU both represent floating-point zero with the integer bit pattern 0, use this parameter to gain execution and ROM efficiency.

This parameter requires that you turn on the configuration parameter Memcpy threshold to enable the memset functionality. Check that the value of the threshold is set high enough.

Off

Generates code to explicitly initialize storage for data of types float and double to 0.0. The resulting code is slightly less efficient than code generated when you select the option.

Dependency

This parameter requires a Simulink® Coder™ license.

Command-Line Information

Parameter: InitFltsAndDblsToZero
Value: 'on' | 'off'
Default: 'off'

Note

The command-line values are reverse of the settings values. Therefore, 'on' in the command line corresponds to the description of “Off” in the settings section, and 'off' in the command line corresponds to the description of “On” in the settings section.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn (GUI), 'off' (command line) (execution, ROM), No impact (RAM)
Safety precautionNo impact

Related Topics