Computer Arithmetic 63
As we can observe, every number, which is to be subtracted, is converted to its two’s complement
form and then added with the rst number. The rst number is also expressed in two’s complement form.
In all cases, if we discard the over ow (indicated at appropriate places), then we get the correct result.
Therefore, using two’s complement representation, addition and subtraction may be performed to get
correct results, after discarding the over ow.
4.3 MULTIPLICATION ALGORITHMS
Apart from addition and subtraction, multiplication is another frequently used arithmetic operation.
Several algorithms are available to implement it with binary numbers, both unsigned as well as signed.
We shall show only a few of those in this section.
4.3.1 Paper and Pencil Method
The paper and pencil method that we adopt to perform multiplication of decimal numbers is also
applicable for binary numbers, as illustrated in Figure 4.5 . Rules of multiplication using binary numbers
are shown in Figure 4.5 (c). Note its similarity with ANDing operation of Boolean algebra. To illustrate
binary multiplication, we have selected two integers, 2 and 3 and shown their multiplication details by
interchanging the multiplier and multiplicand to con rm that the order does not affect the result.
Figure 4.4 Example of subtraction in two’s complement form
Figure 4.5 Example of multiplication method with binary numbers
In the rst case [Figure 4.5 (a)], 3 is multiplied by 2. As 3 in decimal is represented by 0011 and 2 by
0010 in binary, these binary values are written one below the other. Following the basic rule of multipli-
cation as shown in Figure 4.5 (c), four partial products are obtained. Note the way each partial product is
placed in offset with the previous partial product, which we are familiar in our decimal multiplication.
These partial products are nally added together to generate the result. The most important point may
be noted here that the product of two 4-bit numbers may be as long as 8-bit. The same is applicable for
8-bit or 16-bit numbers, which may generate their products as 16-bit or 32-bit respectively.
M04_GHOS1557_01_SE_C04.indd 63M04_GHOS1557_01_SE_C04.indd 63 4/29/11 5:04 PM4/29/11 5:04 PM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.83.151