SLIDE 1
CSZone.co.uk
Click to advance · Arrow keys also work
Cambridge IGCSE 0478 · Topic 1 · 1.1c
Two's Complement &
Binary Arithmetic
Negative Numbers · Binary Addition · Overflow
CSZone
Cambridge IGCSE Computer Science 0478
Binary Addition
Adding Binary Numbers
Rules: 0+0=0 0+1=1 1+0=1 1+1=10 (carry 1)
1+1+1=11 (write 1, carry 1)
Example: 00110101 (53)
+ 00011010 (26)
---------
01001111 (79) ✓
Work right to left, carrying any excess into the next column
Overflow
: when the result is too large to fit in the given number of bits — carry out of the leftmost column
Two's Complement
Representing Negative Numbers
Two's complement
: the most significant bit (MSB) has a negative place value. For 8-bit: MSB is −128. To negate a number: invert all bits, then add 1.
Represent −37 in 8-bit two's complement:
1. Write +37: 00100101
2. Invert bits: 11011010
3. Add 1: 11011011 ← this is −37
Check: −128+64+16+8+2+1 = −128+91 = −37 ✓
Reading Two's Complement
Interpreting Negative Values
If the MSB is 1, the number is negative. The MSB contributes
−128
(for 8-bit), all other bits are positive as normal
Range for 8-bit two's complement:
−128 to +127
Example: 10100000 = −128+32 =
−96
Overflow: adding two positives gives a negative result, or vice versa — the answer is wrong
Exam Practice
Have a go at this question
Cambridge IGCSE 0478 style
Show how the number −45 is represented using 8-bit two's complement. Show your working.
3 marks
+45 = 00101101 [1]. Invert: 11010010 [1]. Add 1:
11010011
[1].
Key Takeaways
What to Remember
Binary addition: 1+1=10, carry the 1; work right to left
Two's complement: MSB has negative value (−128 for 8-bit); to negate: invert + add 1
8-bit two's complement range: −128 to +127
Overflow: result is too large for the number of bits — carry out of the MSB