Multiplication of Binary-Decimal Numbers - Computer Science

Multiplication of binary-decimal numbers

As is known, multiplication of numbers reduces to the summation of partial products obtained by multiplying the current digit of the factor B by the multiplier of A. For binary numbers, partial products are equal to zero or multiplicand. Therefore, the multiplication of binary numbers reduces to the sequential summation of partial products with a shift. For decimal numbers, partial products can take 10 different values, including zero. Therefore, to obtain partial products instead of multiplication, we can use multiple successive summation of the multiplier A. To illustrate the algorithm for multiplying the decimal numbers, let us use an example.

Example 2.26. Fig. 2.15, a multiplication of integer decimal numbers A x b = 54 x 23, starting with the lower order of the multiplier. For multiplication, the following algorithm is used:

• the initial state is 0. The first sum is obtained by adding the multiplier A = 54 to zero. Then the multiplier A = 54 is added to the first sum. Finally, after the third summation, the first partial product is obtained, equal to 0 '+ 54 + 54 + 54 = 162;

The algorithm for multiplying whole decimal numbers 54 x 23 (a) and the principle of its implementation (b)

Fig. 2.15. The algorithm for multiplying whole decimal numbers 54 x 23 (a) and the principle of its implementation (b)

• the first partial product is shifted one bit to the right (or multiplied to the left);

• The multiplier is added twice to the highest digits of the first partial product: 16 + 54 + 54 = 124;

• After combining the received sum 124 with the lower order digit 2 of the first partial product, the product 1242 is found.

Consider, for example, the possibility of circuit implementation of the algorithm using the operations of summation, subtraction and shift.

Example 2.27. Let the constant R t permanently store the multiplicand A = 54. In the initial state, the register R 2 we place the factor B = 23, and load the register R 3 with zeros. To obtain the first partial product (162), add the multiplier A = to the contents of the register three times, decreasing the contents of the register R T each time. After the low order of the R., becomes zero, we shift right one digit of the contents of both registers R, and R,., The presence of 0 in the low order R 2 in indicates that the formation of a partial work is completed and a shift is necessary. Then, we perform two operations of adding the multiplicand A = 54 with the contents of the register and subtracting the unit from the contents of the register R 0. After the second operation, the low order of the register R., becomes zero. Therefore, by shifting right one digit of the contents of the registers R 3 and R Y, we obtain the desired product P = 1242.

The implementation of the algorithm for multiplying decimal numbers in binary-decimal codes (Figure 2.16) has features related to the execution of addition and subtraction operations

Implementing the algorithm for multiplying decimal numbers in binary-decimal codes

Fig. 2.16. Implementation of the algorithm for multiplying decimal numbers in binary-decimal codes

(see paragraph 2.3), as well as the tetrad shift to four positions. Consider them under the conditions of Example 2.27.

Example 2.28. Multiplication of numbers with a floating point. To obtain the product of numbers A and B with floating point, it is necessary to define M c = M M n, P with = P {+ P n. The rules of multiplication and algebraic addition of numbers with a fixed point are used. The product is assigned the + sign if the multiplier and multiplier have the same signs, and the - sign if their signs are different. If necessary, the resultant mantissa is normalized with the appropriate order correction.

Example 2.29. Multiplication of binary normalized numbers:

When executing a multiplication operation, special cases can occur that are handled by special processor instructions. For example, if one of the factors is zero, the multiplication operation is not performed (blocked) and a zero result is immediately generated.

thematic pictures

Also We Can Offer!

Other services that we offer

If you don’t see the necessary subject, paper type, or topic in our list of available services and examples, don’t worry! We have a number of other academic disciplines to suit the needs of anyone who visits this website looking for help.

How to ...

We made your life easier with putting together a big number of articles and guidelines on how to plan and write different types of assignments (Essay, Research Paper, Dissertation etc)