Thursday 20 April 2017

Binary Arithmetic

In binary number system there are only 2 digits 0 and 1, and any number can be represented by these two digits. The arithmetic of binary numbers means the operation of addition, subtraction, multiplication and division. Binary arithmetic operation starts from the least significant bit i.e. from the right most side. We will discuss the different operations one by one in the following article.

Binary Addition:-


There are four steps in binary addition, they are written below
  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 0 (carry 1 to the next significant bit)

Example:-
               10001 + 11101 = 101110:
11
10001
+11101
101110

 101101 + 11001 = 1000110:
1111
101101
+11001
1000110

 1011001 + 111010 = 10010011:
1111
1011001
+111010
10010011

 1110 + 1111 = 11101:
111
1110
+1111
11101

 10111 + 110101 = 1001100:
11111
10111
+110101
1001100

 11011 + 1001010 = 1100101:
111
11011
+1001010
1100101

Binary Subtraction:-


Here are too four simple steps to keep in memory
  • 0 - 0 = 0
  • 0 - 1 = 1, borrow 1 from the next more significant bit
  • 1 - 0 = 1
  • 1 - 1 = 0
A binary arithmetic example is given to understand the operation more clearly.

Example:-


 1011011 − 10010 = 1001001:
1011011
10010
1001001

 1010110 − 101010 = 101100:
00
×110×110110
101010
101100

 1000101 − 101100 = 11001:
011
×1×10×1010101
101100
11001

 100010110 − 1111010 = 10011100:
011110
×1×10×10×10×110110
1111010
10011100

 101101 − 100111 = 110:
010
10×1×1101
100111
110

 1110110 − 1010111 = 11111:
01011010
1×1×1×10×1×110
1010111
11111

Binary Multiplication:-


Here are also four steps to be followed, which are
  • 0×0=0
  • 1×0=0
  • 0×1=0
  • 1×1=1 (there is no carry or borrow for this)

Example:-
   
00101001 × 00000110 = 11110110 



0  0  1  0  1  0  0  1   =   41(base 10)
× 0  0  0  0  0  1  1  0
   =   6(base 10)
0  0  0  0  0  0  0  0 
0  0  1  0  1  0  0  1    
0  0  1  0  1  0  0  1      
 
0  0  1  1  1  1  0  1  1  0   =   246(base 10)
 

00010111 × 00000011 = 01000101



0  0  0  1  0  1  1  1   =   23(base 10)
× 0  0  0  0  0  0  1  1
   =   3(base 10)
   1  1  1  1  1       carries
0  0  0  1  0  1  1  1 
0  0  0  1  0  1  1  1   
 
0  0  1  0  0  0  1  0  1   =   69(base 10


Binary Division:-

Binary division is comprised of other two binary arithmetic operations, multiplication and subtraction; an example will explain the operation more easily.

Example:-

00101010 ÷ 00000110 = 00000111                1  1  1    =   7(base 10)

1  1  0 ) 0  0  1 1 1  0  1  0    =   42(base 10)
    -   1  1  0      =   6(base 10)
 
 
     1     borrows
   1  0 1 1  
   -   1  1  0  
 
 
        1  1  0 
    -   1  1  0 
 
        0 

10000111 ÷ 00000101 = 00011011              1  1  0  1  1    =   27(base 10)

1  0  1 ) 1  0  0 1 0  1  1  1    =   135(base 10)
  -   1  0  1        =   5(base 10)

 
   1  1 1   
 -   1  0  1    
 
 
     1  1   
   -    0   
 
 
     1  1  1  
   -   1  0  1  
 
 
      1  0  1 
    -   1  0  1 
 
        0


No comments:

Post a Comment