Pages

Monday, 22 October 2012

Multiplication & Division

So previously you've learnt about Addition and Subtraction from my fellow mate's post Addition & Subtraction.

Now you will learn more about Multiplication and Division.


Multiplication

Compared with addition and subtraction, multiplication is much more complex operation in both hardware and software.
A wide variety of algorithms have been used in various computers. We start off with the binary multiplication.

Rules of Multiplication
0 x 0 = 0
0 x 1 = 0
1 x 0 = 0
1 x 1 = 1

Example :

   101
x   11
   101  < Firstly , Multiply 101(Multiplicand) to 1(Multiplier) like the ordinary multiplication.
 1010  < Then , add 0 as a placeholder as we would in decimal multiplication , and multiply 101 with 1.
 1111  < Lastly , add 101 (Product of the first multiplication) and 1010 (Product of the second multiplication)


Another example for Binary Multiplication :

          1011  Multiplicand (11)
    x    1101  Multiplier (13)
          1011
        0000    Partial Products
      1011
    1011      
   10001111 Product (143)

#Note : Length of product is the sum of operand lengths.

Flowchart for Unsigned Binary Multiplication

                                            Division

Division is somewhat more complex than multiplication but is based on the same general principles. As before , the operation involves repetitive shifting and addition or subtraction.

Here's an example of binary division :

        11  R = 10
11 ) 1011
      -11
         101
       -11
           10  <  Remainder , R

Flowchart for Unsigned Binary Division

1 comments: