fimath object like the input
RoundingMethod is set to
OverflowAction is set to
'Wrap'. For fixed-point
inputs, this function supports binary-point scaling and slope-bias scaling. If
X is not a
fi object or
numerictype object, then empty is returned.
fimath to be Like Input
setfimath to set the
fimath fixed-point math
settings to be like the input.
Define a fixed-point
X = fi(1,1,8,0)
fimath object with the same fixed-point math settings
as the input.
F = fixed.fimathLike(X)
F = RoundingMethod: Floor OverflowAction: Wrap ProductMode: SpecifyPrecision ProductWordLength: 8 ProductFractionLength: 0 SumMode: SpecifyPrecision SumWordLength: 8 SumFractionLength: 0 CastBeforeSum: true
Apply the fixed-point math settings.
X(:) = setfimath(X,F) + 1
X = 2 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 8 FractionLength: 0
X — Input array
scalar | vector | matrix | multidimensional array
Input array, specified as a scalar, vector, matrix, or multidimensional array.
Complex Number Support: Yes
roundingMethod — Rounding method to use
'Floor' (default) |
Rounding method to use, specified as one of these values:
'Ceiling'— Round toward positive infinity.
'Convergent'— Round toward nearest. Ties round to the nearest even stored integer (least biased).
'Floor'— Round toward negative infinity.
'Nearest'— Round toward nearest. Ties round toward positive infinity.
'Round'— Round toward nearest. Ties round toward negative infinity for negative numbers, and toward positive infinity for positive numbers.
'Zero'— Round toward zero.
overflowAction — Action to take on overflow
'Wrap' (default) |
Action to take on overflow, specified as one of these values:
'Wrap'— Wrap on overflow. This mode is also known as two's complement overflow.
'Saturate'— Saturate to the maximum or minimum value of the fixed-point range on overflow.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Introduced in R2022b