title=Real Numbers: Normalisation
When storing numbers we need to use the space we are given in the most efficient way. For instance if we take a denary floating point number such as
If we were to rewrite it as:
Then you can see the representation takes up an extra 2 characters, the two extra 0's, even though it represents exactly the same number. This may be acceptable when you are not worried about how many characters a number makes up, but in binary and with limited computer memories, the space that numbers take up is very important. We need the most efficient representation we can. With a fixed number of bits, a normalised representation of a number will display the number to the greatest accuracy possible. In summary normalised numbers:
- Give only one representation of a number.
- Save space.
- Give the most accurate representation of a number in a given number of bits.
As a rule of thumb: when dealing with Floating point numbers in binary you must make sure that the first two bits are different. That is:
And most definitely NOT
Let's look at an example. Taking a binary floating point number:
We can see that the number starts with . We need to change this to for it be normalised. To do this we need to move the decimal place one position to the right, and to retain the same number represented by the unnormalised number we need to change the exponent accordingly. With a movement one place right to normalise the number we need to change the exponent to move the decimal point one place left to compensate. Thus subtracting one from the current exponent:
To make sure you have normalised it correctly, check that
Lets try a more complicated example:
To get the mantissa normalised we need to move the decimal point two places to the right. To maintain the same value as the original floating point number we need to adjust the exponent to be two smaller.
Now check that the new normalised value has the same value as the original.
|Make sure that normalising a number does not change the sign bit. e.g. 0.0001 should go to 0.100 and NOT 1.000|
No, as it starts with 0.0
Yes, as it starts with 0.1
No, as it starts with 1.1
00.10000000 111110 = 0.100000000 111110
000.1101000 000100 = 0.110100000 000100
111111.010 111101 = 1.01000000 111101