Login

Back 

Fixed point numbers

Fixed-point representation
We must be able to use 2s complement binary numbers if we are to understand how to do floating-point numbers. The other thing we need to know is fixed-point representation of numbers. This is used because so far we have only represented whole numbers. There are times when we will want to represent fractions.

We could define a byte so that we can represent fractions! A simple way of achieving this is to fix the decimal point in a particular position. Let's set up our byte so we can do this. Some bits will represent whole numbers and some bits will represent fractions. Also notice that the decimal point isn't actually stored; it doesn't take up any of the bit positions. We 'know' where the decimal point is only because we know how we've defined each bit position.

z6

This system is known as the 'Fixed-point' system. How is it used? Here are some examples:

    • 0110 1001 is 8 + 4 + 1 + 1/8 = 13 1/8 (or 13.125)
    • 0001 0110 is 2 + 1/2 + 1/4 = 2 3/4 (or 2.75)
    • 1000 1010 is 8 + 1 + 1/4 = 9 1/4 (or 9.25)

z7

This system is fine if you know in advance that all of your data is a fixed size, within a fixed range. If a group of data is not like that then you will have great trouble deciding where to put the decimal point! In fact, you will need a different system!

If you understand 2s complement and fixed-point numbers then you are ready for binary floating-point numbers! 

Back