Main Content

isscalingslopebias

Determine whether input has nontrivial slope and bias scaling

Description

example

tf = isscalingslopebias(a) returns 1 (true) when the fi object a has nontrivial 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 = isscalingslopebias(T) returns 1 (true) when the numerictype object T has nontrivial slope and bias scaling. Otherwise, it returns 0 (false).

Examples

collapse all

Create a fi object and determine whether it has nontrivial slope and bias scaling.

a = fi(pi)
a = 
    3.1416

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

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

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

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, isscalingslopebias returns 0.

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 = isscalingslopebias(c)
tf = logical
   0

Create a numerictype object and determine whether it has nontrivial slope and bias scaling.

T = numerictype
T =


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

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