Data Representation: Range and precision

Range and precision of fixed point numbers

For fixed point numbers the range and precision is determined by the number of bits used for the whole number and fractional parts.

The more bits used for the whole number the greater the range of numbers that can be represented and the more bits used for the decimal part the greater the accuracy.

-4 2 1 .5 .25 .125 .0625 .03125
0 1 1 1 1 1 1 1
1 0 0 0 0 0 0 0

Largest number: 3.96875 Smallest number: -4 Range: 7.96875 Precision: 0.03125


-16 8 4 2 1 .5 .25 .125
0 1 1 1 1 1 1 1
1 0 0 0 0 0 0 0

Largest number: 15.875 Smallest number: -16 Range: 31.875 Precision: 0.125

Range and precision of floating point numbers

For floating point numbers, the range is affected by the number of bits given to the exponent and the precision by the number of bits given to the mantissa

Mantissa Exponent
-1 0.5 0.25 0.125 0.0625 -4 2 1
1 0 0 0 0 0 1 1
0 1 1 1 1 0 1 1

The smallest number is -8 (-1 x 23) and the largest is 7.5 (.9375 x 23)


Mantissa Exponent
-1 0.5 0.25 -16 8 4 2 1
1 0 0 0 1 1 1 1
0 1 1 0 1 1 1 1
0 0 1 1 0 0 0 0

The smallest number is -32768 (-1 x 215) and the largest is 24576 (.75 x 215)

We can also represent very small numbers such as 0.00000381469726563 (.25 x 2-16)

How accurately numbers can be defined within the range is dependent on the number of bits given for the mantissa.

Fixed point vs floating point binary

Floating point numbers can represent a wider range of numbers with the same number of bits

Floating point numbers can make both larger and smaller values

Fixed point numbers are simpler and so faster to process

Practice questions

Complete the rows below to define the largest and smallest number and the smallest negative and positive decimal that can be made with the given numger of bits.

6 bit mantissa and 4 bit exponent

Mantissa Exponent
-1 0.5 0.25 0.125 0.0625 0.03125 -8 4 2 1

Largest number:   Smallest number:   Smallest positive decimal: 

?

?

?



5 bit mantissa and 3 bit exponent

Mantissa Exponent
-1 0.5 0.25 0.125 0.0625 -4 2 1

Largest number:   Smallest number:   Smallest positive decimal: 

?

?

?



© All materials created by and copyright S.Goff