Real Numbers: Normalisation

From Wikibooks, open books for an open world
Jump to navigation Jump to search

PAPER 2 - ⇑ Fundamentals of data representation ⇑

← Floating point numbers Floating point normalisation Floating point errors →


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

  (Planck's constant)

If we were to rewrite it as:

  (Planck's constant)

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.

Summary: Normalising numbers
  1. Normalise the left hand side (mantissa).
  2. Record the number of ‘bounces’ it has taken to normalise.
  3. Work out the exponent of the normalised number by using: original exponent – ‘bounce’.
  • Normalised numbers start with 2 bits that are different.
  • Make sure that your normalisation does not change the sign of the mantissa.
  • Normalisation provides the maximum precision for a given number of bits.
  • Normalisation makes sure there is only one representation for each number
Exercise: Normalisation Questions

Are the Following numbers normalised?

0.010000000 111111

Answer:

No, as it starts with 0.0

0.111111000 111111

Answer:

Yes, as it starts with 0.1

1.100000010 111111

Answer:

No, as it starts with 1.1

Normalise the following numbers:

0 010000000 111111

Answer:

  1. 0.010000000 111111 -> 00.10000000 111111
  2. One place to the right
  3. 111111 - 1 = -1 -1 = -2 = 000010 (+2) = 111110 (-2)
00.10000000 111110 = 0.100000000 111110

0 001101000 000110

Answer:

  1. 0.001101000 000110 -> 000.1101000 000110
  2. Two places to the right
  3. 000110 - 2 = 6 - 2 = 4 = 000100 (+4)
000.1101000 000100 = 0.110100000 000100

1 111111010 000011

Answer:

  1. 1.111111010 000011 -> 1111111.010 000011
  2. Six places to the right
  3. 000011 - 6 = 3 - 6 = -3 = 111101 (-3)
111111.010 111101 = 1.01000000 111101