Binary system works with only two bits: 0 and 1 unlike the decimal system that works with 10 digits, 0 through 9. Let us take the number 1267 of ordinary decimal system. Its binary equivalent is computed below by successive division by 2. And, then (on the right hand side) 1267 is got back by conversion by weightage of 2*.
Number ¸ 2 Quotient Remainder Weightage, 2* Remainder x 2*
Col. 1 2 3 4 5 = 3 x 4
1267÷ 2 = 633 + 1 2
0
= 1 1
633 ÷ 2 = 316 + 1 2
1
= 2 2
316 ÷ 2 = 158 + 0 2
2
= 4 0
158 ÷ 2 = 79 + 0 2
3
= 8 0
79 ÷ 2 = 39 + 1 2
4
= 16 16
39 ÷ 2 = 19 + 1 2
5
= 32 32
19 ÷ 2 = 9 + 1 2
6
= 64 64
9 ÷ 2 = 4 + 1 2
7
= 128 128
4 ÷ 2 = 2 + 0 2
8
= 256 0
2 ÷ 2 = 1 + 0 2
9
= 512 0
1 ÷ 2 = 0 + 1* 2
10
= 1024 1024
*(Senior digit) 1267
1267 = 10011110011
The equivalent is obtained by writing the contents of Col. 3 starting with the senior digit i.e., from bottom to top.
Binary Arithmetic : 2*, in the above example gives the various positional values: 1, 2, 4, 8, 16, 32, 64…. Just as there is a decimal point there is binary point too. The positional values on both sides of the binary point are given in the table hereunder:
Position 4 3 2 1 0 -1 -2 -3 -4
Position Value 2 4 2 3 2 2 2 1 2 0 2 -1 2 -2 2 -3 2
Quantity represented by Position Value 16 8 4 2 1 1/2 1/4 1/8 1/16
The table can, of course, be extended infinitely on both sides. The decimal equivalent of a number written in binary is found by adding the products of the absolute and positional values as illustrated in the above example where 1267 was got back from 10011110011. This procedure also applies to binary numbers containing binary point. You may want to verify as an exercise that the binary number 1001.011 is 93/8 in the decimal system by using the above table of positional values.
We saw that a whole decimal number can be converted to binary by successive division by 2. The remainder juxtaposed starting from bottom to top yields the binary equivalent. Below is the conversion of a decimal fraction, 0.3125 given to show the procedure, which consists of successive doubling of the fraction (i.e., multiplying by 2), retaining the integers and stopping when we get 0.
.3125
x 2
0 .6250
x 2
1 .2500
x 2
0 .5000
x 2
1 .0000 Stop.
Thus, 0.3125 = 0.0101, the bits having been arranged from top to bottom.
And 9.3125 = 1001.0101.
Binary Addition is performed similar to decimal addition, i.e., we proceed from right to left with a carry over, if any. The following rules are for the carry-over.
1 + 1 = 0 and carry 1 to add to next column.
1 + 0 = 1
0 + 1 = 1
0 + 0 = 0
Example :
Binary addition
Carry over 1 1 1 1 1 1 1 x x 1 x
0 1 1 0 1 0 1 0 0 1 1
+ 1 0 0 1 1 1 1 0 0 1 1
1 0 0 0 0 1 0 0 0 1 1 0
We shall stop here and would not take up binary subtraction, multiplication and division since computer performs these operations too in addition mode. For example, to multiply 9 by 5 it would add 1001 (equivalent of 9) 5 times. Therefore, computer is sometimes simply defined as a fast adder.