Main Content

fixed.aggregateType

Compute aggregate numerictype

Description

example

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.

Examples

collapse all

Aggregate Numeric Type of Two numerictype Objects

a_nt = numerictype(1,16,13);
b_nt = numerictype(1,18,16);
aggNT = fixed.aggregateType(a_nt,b_nt)
aggNT =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 19
        FractionLength: 16

a_nt can represent the range [-4,4) with precision 2^-13. b_nt can represent the range [-2,2) with precision 2^-16. aggNT can represent the range [-4,4) with precision 2^-16.

Aggregate Numeric Type of Two fi Objects

a_fi = ufi(pi,16)
a_fi = 
    3.1416

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Unsigned
            WordLength: 16
        FractionLength: 14
b_fi = sfi(-pi,24)
b_fi = 
   -3.1416

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: 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

Aggregate Numeric Type of a fi Object and an Integer

a_fi = ufi(pi,16);
cInt = uint8(0);
aggNT = fixed.aggregateType(a_fi,cInt)
aggNT =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Unsigned
            WordLength: 22
        FractionLength: 14

a_fi can represent the range [0,3] with precision 2^-14. cInt can represent the range [0,255] with precision 2^0. aggNT can represent the range [0,255] with precision 2^-14.

Input Arguments

collapse all

Input objects, specified as integers, binary point scaled fixed-point fi objects, or numerictype objects.

Output Arguments

collapse all

Aggregate numeric type, returned as a numerictype object.

Version History

Introduced in R2011b

See Also

|