Compute aggregate numerictype
aggNT = fixed.aggregateType(A,B)
aggNT = fixed.aggregateType(A,B)
computes
the smallest binary point scaled numerictype that is able to represent
both the full range and precision of inputs A
and B
.
|
An integer, binary point scaled fixed-point |
|
An integer, binary point scaled fixed-point |
|
A numerictype object. |
Compute the aggregate numerictype of two numerictype objects.
% can represent range [-4,4) and precision 2^-13 a_nt = numerictype(1,16,13); % can represent range [-2,2) and precision 2^-16 b_nt = numerictype(1,18,16); % can represent range [-4,4) and precision 2^-16 aggNT = fixed.aggregateType(a_nt,b_nt) aggNT = DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 19 FractionLength: 16
Compute the aggregate numerictype of two fi
objects.
% Unsigned, WordLength: 16, FractionLength: 14 a_fi = ufi(pi,16); % Signed, WordLength: 24, FractionLength: 21 b_fi = sfi(-pi,24); % Signed, WordLength: 24, FractionLength: 21 aggNT = fixed.aggregateType(a_fi,b_fi) aggNT = DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 24 FractionLength: 21
Compute the aggregate numerictype of a fi
object
and an integer.
% Unsigned, WordLength: 16, FractionLength: 14 % can represent range [0,3] and precision 2^-14 a_fi = ufi(pi,16); % Unsigned, WordLength: 8, FractionLength: 0 % can represent range [0,255] and precision 2^0 cInt = uint8(0); % Unsigned with WordLength: 14+8, FractionLength: 14 % can represent range [0,255] and precision 2^-14 aggNT = fixed.aggregateType(a_fi,cInt) aggNT = DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 22 FractionLength: 14