Ch 5 · Negative Numbers — Two's Complement · Theory
Topic 5 of 14 in Data Representation — How Computers Store Everything as Numbers — 3 lessons.
The Problem with Minus Signs
Computers only store 0s and 1s — there is no separate minus sign. So how do we store −5? The agreed answer is two's complement: the most-significant bit becomes a sign column with a negative value.
Making a Negative Number
To write −20 in 8-bit two's complement:
Range and a Common Trap
An 8-bit two's-complement number holds −128 to +127 (not −128 to +128). There is one more negative value than positive because zero uses up a "positive" slot.
All topics in Theory Data-representation
- Why Computers Use Binary
- Counting in Binary
- Hexadecimal — Shorthand for Binary
- Binary Addition & Overflow
- Negative Numbers — Two's Complement
- Logical Binary Shifts
- Representing Text
- Representing Images
- Representing Sound
- Storage Units & Compression
- Floating-Point Numbers (A Level)
- More Number Representations
- File Organisation & Access (A Level)
- Check Your Understanding