Binary Addition


§Binary Addition :

Binary Addition (base 2) works same as decimal addition (base 10)

Rules :

ResultCarryOver
0+0=00
0+1=10
1+0=10
1+1=01
1+ 1 +1=11

Steps : 101 + 101 =?

1.First consider 1's column and add the one's column (1+1) and it gives 10 as per rules.
2. Now leave the 0 in the one's column and carry the value 1 to the 10's column (carryOver)

//Binary Addition of 101 + 101
     1
  1  0  1
+ 1  0  1
----------
        0

3.Now add 10's place 1+(0+0) = 1. So nothing to carry to 100's place and leave the value 1 in 10's place

//1+0+0 = 1 (No carryOver)
     1
  1  0  1
+ 1  0  1
----------
     1  0

4.Now add the 100's place (1+1) =10 ,leave the value 0 in the 100's place and carry 1 to 1000's place

//1+1=0 (1 carryOver) ,total =10
     1
  1  0  1
+ 1  0  1
----------
1  0  1  0

5.when we get to last , we can directly write the value ( like 10) at the end.

We can add negative binary numbers using two ways :

  1. Binary Addition using 2's Complement
  2. Binary Addition using 1's Complement

Binary Addition using 2's Complement

§Binary Addition using 2's Complement :

we all know how to add two positive binary numbers , but with the 1's complement we can even add two negative binary numbers and one negative with positive.

  1. Postive + Negative, when positive is greater
  2. Positive + Negative , when Negative Number is greater
  3. When Two Negative Numbers

§positive + Negative , when positive is greater

Steps:
1.Find the 1's complement of Negative number , add the positive number and the 1's Complement of Negative number,
2.Then ,we again add the end-around carry of the sum to the result to get the final answer .

Ex: add 1010 to (-1001)

Note: 10102 = 1010 and 10012 = 910 (-9)

Lets find 1's Complement negative binary number (-1001) to (0110)
//1+1 = 0 (1 carryOver,as per Binary Addition Rules)

  1  1          //carryOvers
  1  0  1  0
+ 0  1  1  0
1               //1 is end-around carry
-------------
  0  0  0  0

Now we add end-around carry (1) to the rest of the number which is 0000 .

//0+1=1 (No carryOver,as per Binary Addition Rules)

  0  0  0  0  // addition value of 1010 + 0110
+          1  //end around carry
-------------
  0  0  0  1

Answer is 0001 which is 1 i.e., 10 -9 = 1.

§positive + Negative , when Negative Number is greater

Steps:
1.Find the 1's complement of Negative number , add the positive number and the 1's Complement of Negative number,
2.Now in this case, there is no end-around carry ,so final answer is obtained by taking the 1's complement of resultant value.

Ex: add 0111 and (-1000)

Note: 01112 = 710 and 10002 = 810(-8)

Lets find 1's Complement negative binary number (-1000) to (0111)

Now add 1's complement and postive binary number

//1+1+1 = 1 (1 carryOver,as per Binary Addition Rules)

  1  1  1        //carryOvers
  0  1  1  1
+ 0  1  1  1
-------------
  1  1  1  0

Now find the 1's Complement of resultant 1110 is 0001

Answer is 0001 = 1 i.e., 7-8 = -1.

Here resultant value is 0000 1110 ,when we do 1's complement of it ,we get 1111 0001 .Here MSB is 1 it means Negative number

§When Two Negative Numbers

1.In this case, we represent both the numbers in the 5-bit register by attaching required number of zeros to the left .Then we find 1's complement of both the number & add the values. 2.The End-around carry will be again added to the rest of the number Note: in this case, we will always get a carryOver digit after adding, the 1's complement is to be found for the resultant number. 3.That value with a negative sign will be answer.

Ex: add -1010 & -0101

Note: 10102 = 1010(-10) and 01012 = 510(-5)

In 5-bit register we get 01010 & 00101

Now find 1's Complement of both which we get 10101 & 11010

//1+1 = 0 (1 carryOver,as per Binary Addition Rules)


  1  0  1  0  1
+ 1  1  0  1  0
1                   //end-around carryover
----------------
  0  1  1  1  1

Now we got resultant = 01111 and endaround carry is 1 . Add endaround carry to resultant

//1+1 = 0 (1 carryOver,as per Binary Addition Rules)

     ➀  ➀  ➊         //carryOvers
  0  1  1  1  1
+             1
❶                   //end-around carryover
----------------
  1  0  0  0  0

Now we have to find 1's complement of 100000 which is 01111

Hence -01111 is final answer and -011112 = ( -15 )10

Binary Addition using 1's Complement

§Binary Addition using 1's Complement :

we all know how to add two positive binary numbers , but with the 1's complement we can even add two negative binary numbers and one negative with positive.

  1. Postive + Negative, when positive is greater
  2. Positive + Negative , when Negative Number is greater
  3. When Two Negative Numbers

§positive + Negative , when positive is greater

Steps:
1.Find the 1's complement of Negative number , add the positive number and the 1's Complement of Negative number,
2.Then ,we again add the end-around carry of the sum to the result to get the final answer .

Ex: add 1010 to (-1001)

Note: 10102 = 1010 and 10012 = 910 (-9)

Lets find 1's Complement negative binary number (-1001) to (0110)
//1+1 = 0 (1 carryOver,as per Binary Addition Rules)

  1  1          //carryOvers
  1  0  1  0
+ 0  1  1  0
1               //1 is end-around carry
-------------
  0  0  0  0

Now we add end-around carry (1) to the rest of the number which is 0000 .

//0+1=1 (No carryOver,as per Binary Addition Rules)

  0  0  0  0  // addition value of 1010 + 0110
+          1  //end around carry
-------------
  0  0  0  1

Answer is 0001 which is 1 i.e., 10 -9 = 1.

§positive + Negative , when Negative Number is greater

Steps:
1.Find the 1's complement of Negative number , add the positive number and the 1's Complement of Negative number,
2.Now in this case, there is no end-around carry ,so final answer is obtained by taking the 1's complement of resultant value.

Ex: add 0111 and (-1000)

Note: 01112 = 710 and 10002 = 810(-8)

Lets find 1's Complement negative binary number (-1000) to (0111)

Now add 1's complement and postive binary number

//1+1+1 = 1 (1 carryOver,as per Binary Addition Rules)

  1  1  1        //carryOvers
  0  1  1  1
+ 0  1  1  1
-------------
  1  1  1  0

Now find the 1's Complement of resultant 1110 is 0001

Answer is 0001 = 1 i.e., 7-8 = -1.

Here resultant value is 0000 1110 ,when we do 1's complement of it ,we get 1111 0001 .Here MSB is 1 it means Negative number

§When Two Negative Numbers

1.In this case, we represent both the numbers in the 5-bit register by attaching required number of zeros to the left .Then we find 1's complement of both the number & add the values. 2.The End-around carry will be again added to the rest of the number Note: in this case, we will always get a carryOver digit after adding, the 1's complement is to be found for the resultant number. 3.That value with a negative sign will be answer.

Ex: add -1010 & -0101

Note: 10102 = 1010(-10) and 01012 = 510(-5)

In 5-bit register we get 01010 & 00101

Now find 1's Complement of both which we get 10101 & 11010

//1+1 = 0 (1 carryOver,as per Binary Addition Rules)


  1  0  1  0  1
+ 1  1  0  1  0
1                   //end-around carryover
----------------
  0  1  1  1  1

Now we got resultant = 01111 and endaround carry is 1 . Add endaround carry to resultant

//1+1 = 0 (1 carryOver,as per Binary Addition Rules)

     ➀  ➀  ➊         //carryOvers
  0  1  1  1  1
+             1
❶                   //end-around carryover
----------------
  1  0  0  0  0

Now we have to find 1's complement of 100000 which is 01111

Hence -01111 is final answer and -011112 = ( -15 )10

1's Complement vs 2's Complement

§1's Complement vs 2's Complement: