Computer Engineering Concepts |
Mathematical operations done in the decimal system can also be done with numbers in other bases. This is essential because, if mathematical operations cannot be performed on numbers in different bases, then the usefulness of converting a number to a different base is lost. The various rules of mathematical operations in the decimal system are also valid in other bases. In this section the four operations addition, subtraction, multiplication, and division (+, - , x, ÷) are done on binary numbers and on their equivalent decimal numbers to show that the rules of operations are valid in other bases as well.
Addition
In the decimal system the addition of two numbers is accomplished by starting the adding process at the right most digit and then moving toward the left digits successively. If the sum of the digits is greater than the number of symbols available then a digit is carried forward. This same process can be applied to add numbers in other bases also.
|
By comparing the individual numbers and the results in both bases, it can be seen that the rules of operations are valid for addition. In the first example, when the result 11012 is converted to decimal it is 13. Similarly in the second example, when the result 101002 is converted to decimal it is 20. These results therefore show the validity of the addition rule. In the second example, the problem of a carry forward is encountered, and it is handled in the same manner as the carry forward in the decimal system. 12 +12 = 102 put the 0 down and carry forward the 1.
Subtraction
In the case of subtraction the same process as that of the base ten numbers is applied to the binary numbers. The following two examples show both cases; without borrowing and with borrowing.
|
The concept of borrowing from a left digit to the right is needed in the second example to perform the operation. This is similar to the decimal system. 02 - 12 cannot be accomplished so a 1 is borrowed from the left to achieve 102-12 =12. In the binary case the borrowed digit together with the zero produces two instead of ten. Again by comparing the result of the subtraction in decimal and binary, it can be seen that the rules of subtraction are valid in a different base.
Multiplication
The rules of operation for the multiplication process in other bases is also identical to the process in the decimal base.
|
Here again we follow the rules of multiplication, and we find that the rules are valid for other bases as well. 13 x 3 = 39 is the same result as 11012 x 112 = 1001112. It is interesting to note that multiplication of binary numbers can be viewed as repeated addition of a number that is shifted. This allows the computer to determine the product of two numbers based on the addition of shifted numbers.
Division
In the case of division the process is still the same as that of decimal numbers, but a bit more involved. The long division method can be used to perform the operation. In the event of a remainder, the remainder could be expressed as a number, as a fraction, or as real number.
|
In the second example the number is not evenly divisible, therefore the result of the division is expressed in the form of a quotient and a remainder. Expressing the result as a whole number and a fraction or a real number (decimal number) will be discussed later in section 2.6.
2.4 Practice Questions 1. Perform the given mathematical operation in binary. a. 101+110 b. 1110+10111 c. 11011+11101 d. 10100 -1110 e. 110101-1001 f. 11101-1010 g. 101x11 h. 110x110 i. 1101x101 2. Perform the division operation in binary and state the remainder. a. 11011÷10 b. 101011÷11 c. 11110101÷101 3. Determine the missing binary numbers. a. 101+ _________ = 1100 b. _________ + 10111 =11000 c. 10100 - _________ =110 d. _________ - 1001 = 101000 4. Solve the following algebraic equations in binary. a. 101x + 10 = 1100 b. 11x + 10101 =110x c. 10100 - 1011x = 100 +101x d. 110 + 111x= 1010 110 + 10x 5. Perform the following mathematical operation in the given bases a. 124 +2104 b. 1023 - 123 c. 6248 +2508 d. 123 x 213 e. AF1 +21B f. 1FC2 - 11A6 |