Edexcel International Advanced Level Computer Science, point 2.1.2
a. Binary numbers: the basic units
| Unit | Symbol | Size |
|---|---|---|
| Bit (binary digit) | b | A single 0 or 1, the smallest unit |
| Nibble | 4 bits | |
| Byte | B | 8 bits |
Notice the symbols: a lower-case b is a bit and an upper-case B is a byte. Mixing them up is a common mistake (a speed of 100 Mb/s is not 100 MB/s).
b. IEC binary prefixes (for data capacity and file sizes)
Storage is built in powers of 2, so memory and file sizes use binary prefixes. The IEC names end in "bi".
| Prefix | Symbol | Value | In bytes (1 byte base) |
|---|---|---|---|
| kibi | Ki | 1,024 | |
| mebi | Mi | 1,048,576 | |
| gibi | Gi | 1,073,741,824 | |
| tebi | Ti | 1,099,511,627,776 |
So 1 KiB = 1024 B, 1 MiB = 1024 KiB, 1 GiB = 1024 MiB, and 1 TiB = 1024 GiB.
c. SI decimal prefixes (for transmission speeds)
The SI prefixes are powers of 10. They're used for speeds (bits per second) and often for marketing storage sizes.
| Prefix | Symbol | Value |
|---|---|---|
| kilo | K | |
| mega | M | |
| giga | G | |
| tera | T |
So 100 Mb/s is 100 000 000 bits per second. (Kilo is written K, as in KB, in the specification. Strictly, the SI symbol is a lower-case k, so you may also see kB or kb/s.)
Which to use?
| Use | Units |
|---|---|
| Data capacity and file sizes | Binary (KiB, MiB, GiB, TiB) |
| Transmission speeds | Decimal (Kb/s, Mb/s, Gb/s) |
A drive sold as "1 TB" (decimal, bytes) shows up in the computer as about 0.91 TiB, because the computer divides by . That is why a new drive seems smaller than advertised.
Benefits and drawbacks
| Benefits | Drawbacks | |
|---|---|---|
| IEC binary prefixes | Accurate for memory and storage, which are built in powers of 2; one standard meaning, with no confusion over 1000 or 1024 | Less familiar to most people, so they can be confusing in everyday use |
| SI decimal prefixes | Familiar and easy to work with, as they're powers of 10, like everyday measurements | Don't match binary sizes (1000 bytes isn't 1024), so they're inaccurate for memory and storage, and capacities can look different from what is advertised |
Converting between units
- To a smaller unit: multiply. To a larger unit: divide.
- For binary prefixes, each step is or .
- Bytes to bits: . Bits to bytes: .
Number of states
A group of bits can be arranged in different ways, so it can represent different states (values).
| Bits | States | Example use |
|---|---|---|
| 1 | 2 | On/off |
| 4 | 16 | One hex digit |
| 8 | 256 | One byte (0 to 255 unsigned) |
| 12 | 4,096 | |
| 16 | 65,536 | |
| 24 | 16,777,216 | True-colour pixel (8 bits per colour) |
To find how many bits are needed for states, find the smallest with . For 100 different values, is too small and is enough, so 7 bits are needed.
Writing and interpreting expressions
You may be asked to write an expression for a size, such as the number of bytes in 4 GiB:
or to compare sizes: bytes MiB, so bytes MiB MiB.
Ranking by size (smallest to largest)
bit, nibble, byte, KiB, MiB, GiB, TiB.
When the two systems are mixed, compare the actual sizes. Each binary unit is a little bigger than the decimal unit with the same letter:
1 KB (1000 bytes) < 1 KiB (1024 bytes) < 1 MB (1 000 000 bytes) < 1 MiB (1 048 576 bytes) < 1 GB < 1 GiB
Worked example
Task: a 25 MiB file is sent over a link of 100 Mb/s. Write an expression for the time it takes, ignoring any overheads, and estimate the answer.
- File size in bits: bytes bits (binary prefix, then bytes to bits).
- Link speed: bits per second (decimal prefix).
- Expression:
- Estimate: is a little more than , so the time is a little more than seconds. (Worked out exactly, it's seconds.)
Note the file size uses a binary prefix, the speed uses a decimal prefix, and the bytes had to become bits.
Exam tip: write the unit on every line of working, and check b against B. Use binary prefixes (Ki, Mi, Gi, Ti) for capacity and decimal prefixes (K, M, G) for speed. For "how many values can bits store", the answer is , not or .
Check yourself
How many bytes are in 2 MiB?
2 × 1,048,576 = 2,097,152 bytes.
What is the difference between Mb and MB?
Mb is megabits and MB is megabytes. A byte is 8 bits, so 1 MB is 8 Mb.
How many different values can 10 bits represent?
2¹⁰ = 1024.
How many bits are needed to represent 300 different states?
9 bits (2⁸ = 256 is too few, 2⁹ = 512 is enough).
Which prefixes should be used for a transmission speed, and which for a file size?
Decimal (SI) prefixes such as Kb/s, Mb/s for speeds, and binary (IEC) prefixes such as KiB, MiB for file sizes.