Signed integer division rounds to
How test hardware compiler rounds signed integer division results
Model Configuration Pane: Hardware Implementation
Description
Specify how the compiler for the test hardware rounds the result of dividing two signed integers.
For information on how this option affects code generation, see Hardware Implementation Options (Simulink Coder).
Selecting a device by using the Device vendor and Device type parameters sets a device-specific value for this parameter.
Dependencies
This parameter is enabled only if you can modify it for the selected hardware.
Settings
Zero
(default) | Floor
| Undefined
The table summarizes the compiler behavior that corresponds to each parameter option.
N | D | Ideal N/D | Result for Zero Rounding | Result for Floor Rounding | Result for Undefined Rounding |
---|---|---|---|---|---|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
Undefined
Choose this option if neither
Zero
norFloor
describes the compiler behavior, or if that behavior is unknown.
Tips
You can simulate the rounding behavior of the C compiler you use to compile the code generated from your model by setting the Integer rounding mode parameter for blocks in the model. The setting is on the Signal Attributes tab of the Block Parameters dialog box for blocks, such as the Product block that support signed integer arithmetic.
For most blocks, the Integer rounding mode parameter value for the block completely specifies the rounding behavior. For blocks that support fixed-point data types and the
Simplest
rounding mode, both the Integer rounding mode parameter and the Signed integer division rounds to parameters affect the rounding behavior. For more information, see Rounding (Fixed-Point Designer).
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 impact when Test hardware is the same as production hardware is selected. If it is not selected, no recommendation. |
Programmatic Use
Parameter: TargetIntDivRoundTo |
Type: string | character vector |
Values:
'Floor' | 'Zero' |
'Undefined' |
Default: 'Zero' |
Version History
Introduced in R2006a
See Also
Topics
- Specifying Test Hardware Characteristics (Simulink Coder)
- Hardware Implementation Options (Simulink Coder)
- Hardware Implementation Pane