Use memset to initialize floats and doubles to 0.0


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

Category: Optimization


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


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.


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.


This parameter requires a Simulink® Coder™ license.

Command-Line Information

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


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

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

Related Topics