Friday 15 January 2021

Binary Arithmetic

 

Binary Arithmetic:

 

Before discussing the binary arithmetic, first we will see why are binary numbers used instead of decimal numbers in computer systems? The reasons are as follows:

 

  1. Information is handled by computer’s electronic/ electrical components such as transistors, semiconductors, wires, etc., and all this can indicate only two states or conditions - ON(state 1) or OFF (state 0). Information is represented within a computer by the presence or absence of these types of signals. Binary number system having only two digits (0 and 1) is the most suitable for expressing the two possible states.
  2. By using binary numbers, computer circuits only have to handle two binary digits rather than 10 decimal digits. This greatly simplifies the internal circuit design of computers resulting in in less expensive and more reliable circuits.
  3. Finally, all possible operations in decimal number system are also possible in binary number system.

 

Addition:

 

Binary addition is performed in the same manner as a decimal addition. However, since binary number system has only two digits, the addition table for a binary arithmetic is very simple and consists of only four entries. Table for binary addition is as follows:

 

0 + 0 = 0

0 + 1 = 1

1 + 0 = 1

1 + 1 = 0 plus a carry of 1 to next higher column

 

Carry overs are performed in the same manner as in decimal arithmetic. Since 1 is the largest digit in in binary number system, any sum greater than 1 requires a digit to be carried over.

 

Subtraction:

 

The principles of decimal subtraction can as well be applied to subtraction of numbers in other number systems. It consists of two steps that are repeated for each column of the numbers. The first step is to determine if it is necessary to borrow. If the subtrahend (the lower digit) is larger than the minuend (the upper digit), it is necessary to borrow from the column to the left. It is important to note here that the value borrowed depends upon the base of the number system and is always the decimal equivalent of the base. Hence, in decimal 10 is borrowed, in binary 2 is borrowed, in octal 8 is borrowed, and in hexadecimal 16 is borrowed. The second step is simply to subtract the lower value from the upper value. The table for binary subtraction is as follows:

 

0 - 0 = 0

0 - 1 = 1 with a borrow from the next column

1 - 0 = 1

1 - 1 = 0

 

Multiplication:

 

Multiplication in binary number system also follows the same general rules as multiplication in decimal number system. However, learning binary multiplication is a trivial task because the table for binary multiplication is very short, with only 4 entries. The table for binary multiplication is as follows:

 

0 x 0 = 0

0 x 1 = 0

1 x 0 = 0

1 x 1 = 1

 

Division:

 

Division in binary number system is very simple. As in decimal number system or in any other number system, division by zero is meaningless. A computer deals with this problem by raising an error called ‘divide by zero’ error. Table for binary division is as follows:

 

0➗ 0 = Divide by zero error

0➗ 1 = 0

1➗ 0 = Divide by zero error

1➗ 1 = 1

 

Binary division is performed in a manner similar to decimal division. The rules for binary division are:

 

  1. Start from the left of the dividend.
  2. Perform a series of subtractions, in which the divisor is subtracted from the dividend.
  3. If subtraction is possible, put a 1 in the quotient and subtract the divisor from the corresponding digits of the dividend.
  4. If subtraction is not possible (divisor is greater than remainder), record a 0 in the quotient.
  5. Bring down the next digit to add to the remainder digits. Proceed as before in a manner similar to long division.

No comments:

Post a Comment