Encoding Schemes and Number System
Number systems
Find the value of each digit by its position.
A number system represents numbers with a set of symbols (digits). The number of symbols is its base (or radix). Four number systems are used with computers:
| System | Base | Digits |
|---|---|---|
| Decimal | 10 | 0-9 |
| Binary | 2 | 0, 1 |
| Octal | 8 | 0-7 |
| Hexadecimal | 16 | 0-9, A-F |
These are positional systems: the value of a digit depends on its position. Positions are numbered from the decimal point: the rightmost digit of the whole-number part is position 0, then 1, 2, 3… going left. After the point, positions are –1, –2, –3… going right. Each digit is worth digit × base^position, and the number is the sum of these.
For example, (345.6)₁₀ = 3 × 10² + 4 × 10¹ + 5 × 10⁰ + 6 × 10⁻¹ = 300 + 40 + 5 + 0.6.
- Binary uses only 0 and 1, which match the OFF and ON states of a computer's transistors.
- Octal uses 0-7. Since 8 = 2³, one octal digit stands for exactly 3 bits.
- Hexadecimal uses 0-9 and the letters A-F, where A = 10, B = 11, C = 12, D = 13, E = 14 and F = 15. Since 16 = 2⁴, one hexadecimal digit stands for exactly 4 bits.
Hexadecimal makes long binary numbers short and easier to read. A 16-bit memory address such as 1010111100001111 can be written as just AF0F. Colours on a screen use 24 bits (8 each for red, green and blue), giving about 16 million colours; they are written as three hexadecimal pairs: pure green is (00, FF, 00), white is (FF, FF, FF).
Practise this lesson
Questions that get harder as you improve, a Tutor that helps without giving the answer away, and progress you can see. Free for every learner.
No account, no email address. Opens the real product.