Test yourself on Binary Arithmetic with exam style questions, marked instantly.
Flashcards that come back just before you would forget them.
A revision plan that remembers what you know and shows what to do next.
See which topics you have nailed and which need another look.
Quiz yourself on Binary ArithmeticGet your flashcardsBuild my revision planTrack my progressTwo's Complement - Representing Negative Numbers
The Problem with Simple Sign Bit:
You might think: "Just use the leftmost bit as a sign (0=positive, 1=negative)." This causes problems: two representations of zero (±0), addition doesn't work without special logic.
Two's Complement Solution:
A clever system where the MSB has a negative place value. For 8-bit:
Place values: -128 64 32 16 8 4 2 1 Example: 10000101 = (-128) + 4 + 1 = -123 Range for 8-bit two's complement: -128 to +127
How to Convert to Two's Complement (Make Negative):
Method: Flip all bits, then add 1
Example: Convert +5 to -5
Step 1: Start with +5: 00000101 Step 2: Flip all bits: 11111010 Step 3: Add 1: 11111011 = -5 Check: -128 + 64 + 32 + 16 + 8 + 2 + 1 = -5 ✓
Why Two's Complement is Brilliant:
- Addition works the same for positive and negative numbers!
- Only one representation of zero (00000000)
- Easy to detect sign: if MSB = 1, it's negative
- Subtraction = add the negative (3 - 5 = 3 + (-5))
Example: Add -5 + 3 (Should = -2)
11111011 (-5)
+ 00000011 (+3)
----------
¹¹¹¹¹¹¹¹ ← carries (overflow bit discarded)
1 11111110 (-2)
↑
Overflow bit is ignored in two's complement addition
Check: 11111110 = -128 + 64 + 32 + 16 + 8 + 4 + 2 = -2 ✓
Make this stick
Signing in gives access to all PrepWise features.