Fixed point binary allows us to represent binary numbers that include a decimal point, known as real numbers. Fixed point binary numbers allow us to increase the precision of the numbers that we represent.
When considering the real number data type, it is important to remember that a real number potentially has an infinite number of numbers after the decimal point. In order to represent our numbers efficiently , much like we do in denary we must restrict the number of places that follow the decimal point.
Positive Fixed Point Numbers
Fixed point binary numbers assume that the decimal point remains in a fixed position. The numbers to the left of the decimal point work in exactly the same way as standard binary representation, using the powers of 2 to represent each bit. On the right hand of the decimal point each column is represented using a fractional number. The easiest way of identifying each column is to use the fraction version of the powers of 2 in the opposite direction as shown below:
In the example above, the integer section of the number is calculated in the same way that we would convert an unsigned (positive) binary integer. After that, the decimal part of the number is converted using the fraction columns.
Negative Fixed Point Numbers
Negative fixed point binary numbers use the same procedure as positive numbers but also make use of the methodology we saw in twos compliment. When representing a negative decimal number in a fixed point notation a simple process to apply is as follows:
- set up the columns with the most significant bit as a minus number
- convert the positive version of the number into its fixed point binary format
- identify the least significant one
- retain the same numbers for the least significant one and any trailing zeros
- flip all other digits towards the most significant figure