5. Adding binary numbers and overflows

Binary numbers can easily be added using a few addition rules. These are

0 + 0 = 0

0
+
0
=0
 

 

0 + 1 = 1

0
+
1
=1
 

 

1 + 1 = 10

1
+
1
=10
 

1+1+1 = 11

1
+
1
1
 
=11

This last one is dealing with a possible carry 1 from the previous calculation

 

Worked example

We are going to add together the following two binary numbers:

00011101
10011011

 

Step 1

Start off by putting them on the top two rows in a four table:

0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
1
               
               

 

The third row will be used to hold any 'carry over' numbers

The fourth row will be used to hold the answer to the calculation

 

Step 2

Adding the column on the right hand side which contains the following:

1
1

From the rules above, we know that 1 + 1 =10.

We put a 0 on the bottom row of column 8 and we carry the 1 over to the third row of column 7 so we can use it in the next step (see table below)

 

Col 1

Col 2

Col 3

Col 4

Col 5

Col 6

Col 7

Col 8

0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
1
1
0

 

Step 3

The column on the right (column 8) is now finished with. We move onto column 7.

Column 7 contains the numbers:

0
1
1

The top two rows are from the original number and the third row has been carried over from the previous calculation.

We add these three rows together. Adding 1 + 1 gives us the result 10.

We put 0 in the bottom row of column 7 and carry the 1 to the third row of column 6

 

Col 1

Col 2

Col 3

Col 4

Col 5

Col 6

Col 7

Col 8

0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
1
1
1
0
0

 

Step 4

Column 7 is now finished with. We now work on column 6.

Column 6 contains the numbers:

1
0
1

We know that adding 1 + 1 gives us the result 10.

We put 0 in the bottom row of column 6 and carry over 1 to column 5.

Col 1

Col 2

Col 3

Col 4

Col 5

Col 6

Col 7

Col 8

0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
1
1
1
1
0
0
0

 

Step 5

Column 6 is now finished with. We now work on column 5.

Column 5 contains the numbers:

1
1
1

We know that adding 1 + 1 gives us the result 10 then adding a third 1 gives 11.

We put 1 in the bottom row of column 5. Again, we can carry 1 over to column 4.

Col 1

Col 2

Col 3

Col 4

Col 5

Col 6

Col 7

Col 8

0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
1
1
1
1
1
1
0
0
0

 

Step 6

Column 5 is now finished with. We now work on column 4.

Column 4 contains the numbers:

1
1
1

We know that adding 1 + 1 gives us the result 10 and a third 1 gives 11.

We put a 1 on the bottom row of column 4 and we carry the 1 over to the third row of column 3

Col 1

Col 2

Col 3

Col 4

Col 5

Col 6

Col 7

Col 8

0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
1
1
1
0
1
1
1
1
0
0
0

 

Step 7

Column 4 is now finished with. We now work on column 3.

Column 3 contains the numbers:

0
0
1

Here is the result: there is no carry in this case

Col 1

Col 2

Col 3

Col 4

Col 5

Col 6

Col 7

Col 8

0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
1
0
1
1
0
1
1
1
1
1
0
0
0

 

Step 8

We now work on column 2:

0
0
0

Here is the result:

Col 1

Col 2

Col 3

Col 4

Col 5

Col 6

Col 7

Col 8

0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
1
0
0
1
0
0
1
1
0
1
1
1
0
0
0

 

Step 8

Finally, we work on column 1:

0
1
0

Here is the result:

Col 1

Col 2

Col 3

Col 4

Col 5

Col 6

Col 7

Col 8

0
0
0
1
1
1
0
1
1
0
0
1
1
0
1
1
0
0
1
1
1
1
1
1
0
1
1
1
0
0
0

 

After following all of those steps, the answer to adding the two binary numbers:

00011101 +
10011011

--------------
10111000

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Binary Calculator

 

 

 

Copyright © www.teach-ict.com