1111 × 1111 — binary arithmetic
coren-bit × n-bit needs 2n bits
Answer
0000000011100001
Why this example is worth doing
The largest four-bit product, which needs eight bits to hold. That is the general rule — multiplying two n-bit values can need 2n bits — and it is why multiply instructions either produce a double-width result or expose the high half separately. The page makes the width point explicitly because truncating a product silently is a common and hard-to-find bug.
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
00001111 x 00001111 (8-bit unsigned)
| operand | bits | hex | unsigned | signed |
|---|---|---|---|---|
| A | 00001111 | 0x0F | 15 | 15 |
| B | 00001111 | 0x0F | 15 | 15 |
Shift and add: one partial product per multiplier bit, each shifted left by its bit index. A 8 x 8 multiply needs 16 bits of product.
| bit index | multiplier bit | partial product | meaning |
|---|---|---|---|
| 0 | 1 | 0000000000001111 | |A| << 0 |
| 1 | 1 | 0000000000011110 | |A| << 1 |
| 2 | 1 | 0000000000111100 | |A| << 2 |
| 3 | 1 | 0000000001111000 | |A| << 3 |
| 4 | 0 | 0000000000000000 | 0 (multiplier bit is 0) |
| 5 | 0 | 0000000000000000 | 0 (multiplier bit is 0) |
| 6 | 0 | 0000000000000000 | 0 (multiplier bit is 0) |
| 7 | 0 | 0000000000000000 | 0 (multiplier bit is 0) |
sum of partial products0000000011100001
product0000000011100001 = 225