teach-ict.com logo

THE education site for computer science and ICT

1. Adding floating point

Before doing this, you should have read the two sections on floating point, normalising floating point.

To add two floating point numbers, the binary point needs to be alligned before normal binary addition takes place.

Consider these two floating point numbers that have mantissa and exponent parts

             0.1001001      011
             0.0111001      010 +

The first thing to do is to use the exponent to place the binary point. The first number is exponent 3, so the point needs to shift 3 to the right. And the second exponent is 2 to the right. These are the two numbers re-aligned

             0100.1001   
              001.11001   +

Next pad them out with zeroes

             0100.10010   
             0001.11001   +

Add them using the rules 0+0 = 0, 1 + 0 = 1, 1+1 = 0 carry 1, 1+1+1 = 1 carry 1.

             0100.10010   
             0001.11001   +
                  -------------
             0110.01011  

For a positive number to be normalised, it needs to start with 01, which it is, and also the binary point needs to be between the 01 pattern. The result above needs the point moved three to the left and so the exponent has to have the number 3 in it.

The final answer is (with mantissa and exponent)

             0.11001011   011