Main Content

Fraction Length Greater Than Word Length

A fraction length greater than the word length of a fixed-point number occurs when the number has an absolute value less than one and contains leading zeros.

x = fi(.0234,1,8)
x = 

    0.0234

          DataTypeMode: Fixed-point: binary point scaling
            Signedness: Signed
            WordLength: 8
        FractionLength: 12

View the binary representation of x.

disp(bin(x))
01100000

There are four implicit leading zeros after the binary point and before the binary representation of the stored integer because the fraction length of x is four greater than the word length.

Convert from binary to decimal the binary representation of x with four leading zeros, and scale this value according to the fraction length.

bin2dec('000001100000')*2^(-12)
ans =

    0.0234

The result is the real world value of x.

You can also find the real world value using the equation Real World Value = Stored Integer Value × 2Fraction Length.

Start by finding the stored integer of x.

Q = storedInteger(x)
Q =

   96

Use the stored integer to find the real world value of x.

real_world_value = double(Q) * 2^-x.FractionLength
real_world_value =

    0.0234

See Also