Use the two’s complement number system to represent positive and negative 8-bit binary integers
Data Representation: Two’s Complement for 8‑bit Integers
Objective 🎯
Use the two’s complement number system to represent positive and negative 8‑bit binary integers.
What is Two’s Complement? 🤔
In binary, the leftmost bit (most significant bit) is the sign bit.
• 0 → positive number
• 1 → negative number
Two’s complement lets us store negative numbers in the same 8‑bit format as positives.
How to Convert a Decimal to 8‑bit Two’s Complement
- Write the decimal number in binary (ignore the sign for now).
- If the number is negative, invert all bits (change 0→1, 1→0).
- Add 1 to the inverted binary number.
- Keep only the lowest 8 bits (drop any overflow).
Example: Convert –5 to 8‑bit two’s complement.
1️⃣ 5 in binary: 00000101
2️⃣ Invert: 11111010
3️⃣ Add 1: 11111011
Result: 11111011 (which equals –5 in two’s complement)
Examples Table 📊
| Decimal | Binary (8‑bit) | Two’s Complement |
|---|---|---|
| +12 | 00001100 | 00001100 |
| –12 | 11110011 | 11110011 |
| +255 | 11111111 | 11111111 |
| –1 | 11111110 | 11111111 |
Exam Tips for IGCSE 0478 📚
- Remember: Leftmost bit = sign. 0 = positive, 1 = negative.
- When converting negatives, invert then add 1. A quick mental trick: “flip and bump.”
- Check overflow: only keep the lowest 8 bits.
- Practice converting both ways: decimal → binary → two’s complement, and two’s complement → decimal.
- Use the
2⁸ = 256rule: the range of 8‑bit two’s complement is –128 to +127.
Quick Practice Problems ??
- Convert +42 to 8‑bit two’s complement.
- Convert –100 to 8‑bit two’s complement.
- What is the decimal value of binary
11001010in two’s complement? - Show the steps to convert –15 to binary.
Tip: Write down each step; examiners love clear, logical reasoning. Good luck! 🚀
Revision
Log in to practice.
1 views
0 suggestions