Main Content

isscalingbinarypoint

Determine whether input has binary point scaling

Description

tf = isscalingbinarypoint(a) returns 1 (true) when the fi object a has binary point scaling or trivial slope and bias scaling. Otherwise, it returns 0 (false). Slope and bias scaling is trivial when the slope is an integer power of two and the bias is zero.

example

tf = isscalingbinarypoint(T) returns 1 (true) when the numerictype object T has binary point scaling or trivial slope and bias scaling. Otherwise, it returns 0 (false).

example

Examples

collapse all

Create a fi object and determine whether it has binary point scaling.

a = fi(pi)
a = 
    3.1416

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 13
tf = isscalingbinarypoint(a)
tf = logical
   1

b = fi(pi,1,16,3,2)
b = 
     2

          DataTypeMode: Fixed-point: slope and bias scaling
            Signedness: Signed
            WordLength: 16
                 Slope: 3
                  Bias: 2
tf = isscalingbinarypoint(b)
tf = logical
   0

If the fi object has trivial slope and bias scaling, that is, the slope is an integer power of two and the bias is zero, isscalingbinarypoint returns 1.

c = fi(pi,1,16,4,0)
c = 
     4

          DataTypeMode: Fixed-point: slope and bias scaling
            Signedness: Signed
            WordLength: 16
                 Slope: 2^2
                  Bias: 0
tf = isscalingbinarypoint(c)
tf = logical
   1

Create a numerictype object and determine whether it has binary point scaling.

T = numerictype
T =


          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 16
        FractionLength: 15
tf = isscalingbinarypoint(T)
tf = logical
   1

Input Arguments

collapse all

Input fi object, specified as a scalar, vector, matrix, or multidimensional array.

Data Types: fi

Input numerictype object, specified as a scalar.

Version History

Introduced in R2010b