Year 8 · Spring 1
Representations: from clay to silicon · Lesson 3 of 5
Binary addition and overflow
TheoryTopic 3 Binary, denary and hex
Year 8 · Representations: from clay to silicon · Lesson 3 of 5
You will learn to
- Use the four rules of binary addition: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 and 1 + 1 + 1 = 11.
- Add two 8-bit numbers column by column, from right to left, carrying when needed.
- Explain overflow: the answer needs a ninth bit, so the last carry is lost.
- Explain that a shift left multiplies by 2 and a shift right divides by 2.
Year 8 · Representations: from clay to silicon · Lesson 3 of 5
Success criteria
You have got it when you can say:
- I can add two bytes and check the answer in denary.
- I can explain why 255 + 1 gives 0 in a byte.
- I can spot a sum that will overflow, because its total is more than 255.
Year 8 · Representations: from clay to silicon · Lesson 3 of 5
Retrieval starter
Questions from before. Write your answers, then show them.
- Last lesson
One hex digit equals…
A 4 bitsB 1 bitC 8 bits
A. 4 bits
- Last unit
A box has width 100px, padding 10px, border 2px, margin 5px. How wide is it on screen, from border edge to border edge?
A 124pxB 134pxC 112px
A. 124px
- Earlier this year
A CPU runs at 2 GHz. How long is one tick?
A 0.2 nsB 0.5 nsC 2 ns
B. 0.5 ns
Year 8 · Representations: from clay to silicon · Lesson 3 of 5
Key words (1 of 2)
- most significant bit
- Most significant bit: the leftmost bit, worth the most.
- least significant bit
- Least significant bit: the rightmost bit, worth 1.
- overflow
- A result too big for the bits available.
- Denary
- Base 10. Our everyday numbers.
Year 8 · Representations: from clay to silicon · Lesson 3 of 5
Key words (2 of 2)
- Binary
- Base 2. Digits 0 and 1. Columns 128 64 32 16 8 4 2 1.
- Hexadecimal
- Base 16: digits 0–9 then A–F. One digit = 4 bits.
The explanation · step 1 of 3
Binary place values
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|
Start at 1 on the right. Double each time you move left. 1, 2, 4, 8, 16, 32, 64, 128. Learn this row by heart.
The leftmost bit is the most significant bit. The rightmost is the least significant bit.
The explanation · step 2 of 3
Overflow
A byte holds at most 255. 200 + 100 = 300 needs a 9th column, which doesn't exist. The carry is lost and the byte holds 44. That is an overflow error.
An old game score suddenly jumping back to a tiny number.
The explanation · step 2 of 3
The maths: What a byte stores after overflow
The explanation · step 3 of 3
Binary shifts
- Shift left 1 place = × 2. 00010110 (22) → 00101100 (44).
- Shift right 1 place = ÷ 2. 00010110 (22) → 00001011 (11).
- 2 places = × or ÷ 4. 3 places = × or ÷ 8.
Bits pushed off the end are lost. 11 shifted right gives 5, not 5.5.
The explanation · step 3 of 3
The maths: Binary shifts
Year 8 · Representations: from clay to silicon · Lesson 3 of 5
Quick quiz · 1 of 3
00000101 in denary is…
- A 6
- B 101
- C 5
C. 5
The 1s are under 4 and 1. 4 + 1 = 5.
Year 8 · Representations: from clay to silicon · Lesson 3 of 5
Quick quiz · 2 of 3
1111 in hex is…
- A 15
- B F
- C E
B. F
1111 = 8 + 4 + 2 + 1 = 15, and 15 is written F.
Year 8 · Representations: from clay to silicon · Lesson 3 of 5
Quick quiz · 3 of 3
Shifting left by 1 place…
- A Halves the number
- B Doubles the number
- C Adds 1
B. Doubles the number
Every bit moves into a column worth twice as much.
Year 8 · Representations: from clay to silicon · Lesson 3 of 5
Exit ticket
Answer on paper before you go. Then check.
What is 1011 in denary?
A 13B 11C 7
B. 11 8 + 2 + 1 = 11. Add the columns that hold a 1.
What is 200 in 8-bit binary?
A 11001000B 11010000C 10011000
A. 11001000 128 fits (72 left), 64 fits (8 left), then 8 fits: 11001000.