Why is my fixed-point number's FractionLength value greater than its WordLength value?

3 views (last 30 days)
I create a fixed-point number with the following command
z=fi(-0.002)
and the following information appears
z =
-0.0020
DataTypeMode: Fixed-point: binary point scaling
Signed: true
WordLength: 16
FractionLength: 23
RoundMode: nearest
OverflowMode: saturate
ProductMode: FullPrecision
MaxProductWordLength: 128
SumMode: FullPrecision
MaxSumWordLength: 128
CastBeforeSum: true
The WordLength value is 16 bits, however, the FractionLength value seems to be 23 bits. Thus, there is some kind of error.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2021
Edited: MathWorks Support Team on 18 Oct 2021
The terminology used in fixed-point math can be confusing, but it looks like there is nothing wrong with the FractionLength value, as it is not measured in terms of number of bits. The documentation at the following location discusses scaling of fixed-point values:
https://www.mathworks.com/help/releases/R2020b/fixedpoint/ug/fixed-point-numbers.html
"fraction length" is defined to be the negative of the fixed exponent value. Thus, even though we are dealing with a 16-bit word length, there is no requirement for the fraction length to be less than 16.
The documentation at the following location discusses the concept of fraction length that is greater than word length or negative.
https://www.mathworks.com/help/releases/R2020b/dsp/ref/fixed-point-filter-properties.html
Under the secton titled Property Details for Fixed Point Filter, there is a sub-section titled Notes About Fraction Length, Word Length, and Precision.

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!