Signed integer division rounds to
R2026bHow compiler for selected hardware rounds results of signed integer division
Model Configuration Pane: Hardware Implementation
Description
The Signed integer division rounds to parameter describes how the compiler for the hardware rounds the result of dividing two signed integers.
Dependencies
This parameter is enabled only if you can modify it for the selected hardware.
Settings
Zero (default) |
Undefined |
FloorSelecting a device by using the Device vendor and Device type parameters sets a device-specific value for this parameter.
-
Undefined Choose this option if neither
ZeronorFloordescribes the compiler behavior, or if that behavior is unknown.-
Zero If the quotient is between two integers, the compiler chooses the integer that is closer to zero as the result.
-
Floor If the quotient is between two integers, the compiler chooses the integer that is closer to negative infinity.
Tips
To simulate rounding behavior of the C compiler that you use to compile generated code, use the Integer rounding mode parameter for blocks. This setting appears on the Signal Attributes pane of the parameter dialog boxes of blocks that can perform signed integer arithmetic, such as the Product block.
For most blocks, the value of Integer rounding mode completely defines rounding behavior. For blocks that support fixed-point data and the
Simplestrounding mode, the value of Signed integer division rounds to also affects rounding. For details, see Rounding Modes (Fixed-Point Designer).For more information on how this parameter affects code generation, see Hardware Implementation Options (Simulink Coder).
This table lists the compiler behavior described by the options for this parameter.
N D Ideal N/D Zero Floor Undefined 334
8.25888-334-8.25-8-9-8or-933-4-8.25-8-9-8or-9-33-48.25888or9
Recommended Settings
| Application | Setting |
|---|---|
| Debugging | No impact for
simulation or during
development.Undefined for
production code generation. |
| Traceability | No impact for
simulation or during
development.Zero or
Floor for production code generation. |
| Efficiency | No impact for
simulation or during
development.Zero for production
code generation. |
| Safety precaution | No
recommendation for
simulation without code generation. |
Programmatic Use
Parameter:
ProdIntDivRoundTo
|
| Type: string | character vector |
Value:
"Floor" | "Zero" | "Undefined"
|
Default:
'Zero'
|
Version History
Introduced in R2006b
See Also
Topics
- Hardware Implementation Pane
- Hardware Implementation Options (Simulink Coder)
- Specifying Production Hardware Characteristics (Simulink Coder)