1011 × 101 — binary arithmetic

coreshift and add

Answer

000000110111

Why this example is worth doing

Binary long multiplication, which is easier than decimal because every partial product is either the multiplicand or zero — there is no multiplication table. The whole operation is shift and add, and that is exactly how a hardware multiplier works. The page aligns the partial products with their shifts visible, and gives the decimal check: eleven times five is fifty-five.

Try your own input in the Binary arithmetic. Add, subtract, multiply and divide in binary with every carry and borrow shown.

How the answer is reached

001011 x 000101 (6-bit unsigned)

001011 x 000101 (6-bit unsigned) — columns operand, bits, hex, unsigned, signed
operandbitshexunsignedsigned
A0010110x0B1111
B0001010x0555

Shift and add: one partial product per multiplier bit, each shifted left by its bit index. A 6 x 6 multiply needs 12 bits of product.

001011 x 000101 (6-bit unsigned) — columns bit index, multiplier bit, partial product, meaning
bit indexmultiplier bitpartial productmeaning
01000000001011|A| << 0
100000000000000 (multiplier bit is 0)
21000000101100|A| << 2
300000000000000 (multiplier bit is 0)
400000000000000 (multiplier bit is 0)
500000000000000 (multiplier bit is 0)

sum of partial products000000110111

product000000110111 = 55

Compare with

Open the Binary arithmetic

This input is entered in the tool itself — it is too rich for a link to carry.

Note:

Notation this page assumes

  • Bit strings are written most significant bit first, and bit 0 is the least significant bit.
  • A width is stated explicitly wherever it changes the answer; nothing is silently sign-extended or truncated.
  • Fractions are converted digit by digit and shown to a stated number of places rather than rounded silently.

Sources

  • Knuth, The Art of Computer Programming, Vol. 2, §4.3.1 “The Classical Algorithms” (1997)