When two numbers are multiplied in binary, the standard approach generates one partial product for each bit in the multiplier: shift the multiplicand left, add it in if the bit is 1, skip it if the bit is 0. The final product is the sum of all those shifted copies.
That works fine for unsigned integers. But it breaks for negative numbers in two's-complement representation — the standard format used by every modern CPU. Extending the shift-and-add trick naively to negative values corrupts the result because the sign bit has a negative weight.
In 1951, Andrew D. Booth noticed something elegant: a run of consecutive 1 bits, like , has the same value as — one power-of-two minus another. Instead of adding four partial products, you can do just one addition and one subtraction, then move on. The longer the run, the bigger the saving.
Booth's algorithm turns this observation into a systematic rule that works correctly for signed two's-complement integers without any special casing — and it cuts the number of partial products roughly in half.
Comments
Loading comments...