Floating point number normalisation
More on normalisation
Numbers can be represented in different ways using floating-point notation. To illustrate this point using decimal, suppose you have this number: 45379510 How could 45379510 be represented using the floating-point system?
453795 x 102 or 4537 x 104 or 45 x 106 or 0.0045379510 x 1010 and so on.
Look at this example, which uses 10 places after the decimal point: 0.0045379510 x 1010 You could write it like this 0.00453795 x 1010 if you only had 8 places after the decimal point. The problem with this is that you have lost some of the accuracy of the number. (You had to round down the ‘510’ at the end of the number into a ‘5’). If you only had 8 places after the decimal point, you might prefer this: 0.45379510 x 108 You have kept the accuracy and still used only 8 places after the decimal point. Also, by having a smaller number of places after the decimal point, you have increased the number of places you can use for the exponent, thereby increasing the range of numbers you can represent.
How did we keep the accuracy for the same number of mantissa places? We did it by getting rid of 'leading zeros'. In other words, we didn't write down 0.00453 etc, we wrote down 0.453 etc. We ended up with the same number, improved accuracy and still used only 8 places for the mantissa.
The process of ensuring the maximum accuracy for a fixed number of bits is known as ‘normalisation’.
Normalisation ensures that maximum accuracy of a number for a given range of bits.
It also ensures that each number has only one possible bit pattern to represent it!
Some denary examples of the process of normalisation:
3004 x104 normalised is 0.3004 x 108 (Check to see if these numbers are the same.)
0.0005 x 102 normalised is 0.5 x 10-1 (Check to see if these numbers are the same.)
Normalisation of positive binary numbers
Exactly the same principle applies in binary representation. You are aiming for a number that lies between ½ and 1 for positive binary numbers. A different way of saying this is that the first two numbers in the mantissa must be '01'.
Example 25. Convert this number into its normalised form: 0000 1101 0100 0100
- The mantissa has 10 bits and there are 6 bits for the exponent.
- The mantissa is 00001101011, which isn't normalised. We know this because this is a positive number (the first bit from the left of the mantissa is a zero) and the first two digits are not 01.
- We must aim to get rid of the leading zeros from the mantissa to normalise the number.
- The mantissa is 0000110101 If we show the decimal place, the number is actually 0.000110101
- Moving the decimal point between the first 01 pair we come to starting from the left of the number, the number becomes 0000.110101
- Discard any excess zeros at the front of the number and add excess zeros to the end, to maintain the correct mantissa size. We now have 0.110101000
- This is now in the form we want. The first two digits are "01".
- Now we need to adjust the exponent. The exponent was 000100, or 4 in denary.
- To get 0.110101000 back to 0.000110101 we must move the decimal point 3 places to the left.
- We must therefore subtract 3 places from the current exponent.
- This means the new exponent is 000001
- Putting mantissa and exponent together, the normalised form of the number is 0110 1010 0000 0001
Representing zero in the normalised form
Note that you cannot represent zero in the normalised form because normalised numbers must begin with 01 for positive numbers and 10 for negative numbers. To represent zero, you have to cheat and use a number that is very close to zero, either a very small positive number or a very small negative number!