Set quotient to 0
Align leftmost digits in dividend and divisor
Repeat
- If that portion of the dividend above the divisor is greater
than or equal to the divisor
- Then subtract divisor from that portion of the dividend
and
- Concatentate 1 to the right hand end of the quotient
- Else concatentate 0 to the right hand end of the quotient
- Shift the divisor one place right
Until dividend is less than the divisor
quotient is correct, dividend is remainder
STOP
Binary Multiply - Repeated Shift and Add
Repeated shift and add - starting with a result of 0, shift the second multiplicand to correspond with each 1 in the first multiplicand and add to the result. Shifting each position left is equivalent to multiplying by 2, just as in decimal representation a shift left is equivalent to multiplying by 10.
Set result to 0
Repeat
- Shift 2nd multiplicand left until rightmost digit is lined up
with leftmost 1 in first multiplicand
- Add 2nd multiplicand in that position to result
- Remove that 1 from 1st multiplicand
Until 1st multiplicand is zero
Result is correct
STOP
|
|