Main Content
Divide input by a constant and round to integer
Since R2021a
expand all in page
Libraries:
Fixed-Point Designer
Description
The Divide by Constant and Round block outputs the result of dividing the input by a constant and rounds the result to an integer using the specified rounding method.
The Divide by Constant and Round block uses an algorithm that is functionally similar to the Granlund-Montgomery-Warren Method. The division operation is computed via a multiplication by inverse, which generally results in better performance on embedded systems.
Ports
Input
expand all
X — Dividend
scalar | vector | matrix | N-D array
Dividend, specified as a scalar, vector, matrix, or N-D array.
Divide by Constant and Round does not support data types with word length greater than 128. Slope-bias representation is not supported for fixed-point data types.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| Boolean
| fixed point
Complex Number Support: Yes
Output
expand all
Y — Result of division and round operation
scalar | vector | matrix | N-D array
Result of division and round operation, returned as a scalar, vector, matrix, or N-D array.
Data Types: single
| double
| int8
| int16
| int32
| uint8
| uint16
| uint32
| Boolean
| fixed point
Parameters
expand all
Denominator — Divisor
10 (default) | scalar
Divisor, specified as a positive, real-valued, finite scalar.
Programmatic Use
Block Parameter: Denominator |
Type: character vector |
Values: MATLAB® expression that evaluates to a positive, real-valued, finite fixed point or numeric value |
Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point |
Default: '10' |
Rounding Method — Rounding method to use
Floor
(default) | Ceiling
| Nearest
| Zero
| Convergent
Rounding method to use, specified as one of these values:
Floor
— Round to nearest integer in the direction of negative infinity.Ceiling
— Round to nearest integer in the direction of positive infinity.Nearest
— Round to the nearest integer. Ties are rounded to the nearest integer in the direction of positive infinity.Zero
— Round to the nearest integer in the direction of zero.Convergent
— Round to the nearest integer. Ties are rounded to the nearest even integer.
Programmatic Use
Block Parameter: RndMeth |
Type: character vector |
Values: 'Floor' | 'Ceiling' | 'Nearest' | 'Zero' | 'Convergent' |
Default: 'Floor' |
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Slope-bias representation is not supported for fixed-point data types.
Version History
Introduced in R2021a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Contact your local office