Booth's multiplication algorithm: Difference between revisions

Content deleted Content added
m add {{Use dmy dates}}
Clarify example on how to fix the case where the multiplicand is the smallest representable number.
Line 46:
* The product is 1111 0100, which is −12.
 
The above-mentioned technique is inadequate when the multiplicand is the [[two's complement#Most negative number|most negative number]] that can be represented (e.g. if the multiplicand has 4 bits then this value is −8). This is because then an overflow occurs when computing -m, the negation of the multiplicand, which is needed in order to set S. One possible correction to this problem is to addextend oneA, moreS, and P by one bit toeach, while they still represent the leftsame ofnumber. AThat is, Swhile −8 was previously represented in four bits by 1000, andit Pis now represented in 5 bits by 1 1000. This then follows the implementation described above, with modifications in determining the bits of A and S; e.g., the value of '''m''', originally assigned to the first ''x'' bits of A, will be now be extended to ''x''+1 bits and assigned to the first ''x''+1 bits of A. Below, the improved technique is demonstrated by multiplying −8 by 2 using 4 bits for the multiplicand and the multiplier:
* A = 1 1000 0000 0
* S = 0 1000 0000 0