A deeper dive into why binary representation matters practically — overflow errors, real number precision, and how bit patterns represent things beyond plain numbers.
Reasons for representing data in binary: computer hardware (CPU registers) works with a fixed word size — a fixed number of bits — which has real consequences for the range of values that can be stored.
Representing integers:
| Type | Formula (n bits) | Example (8 bits) |
|---|---|---|
| Unsigned integer range | 0 to (2ⁿ − 1) | 0 to 255 |
| Signed integer range | −2ⁿ⁻¹ to (2ⁿ⁻¹ − 1) | −128 to 127 |
Example
An 8-bit unsigned integer can hold 0–255. If you calculate 250 + 10 = 260, but only 8 bits are available, the result overflows and wraps to an incorrect value (4, since 260 − 256 = 4) instead of the mathematically correct 260.
Representing real numbers uses a mantissa and exponent (similar to scientific notation): the mantissa stores the significant digits, and the exponent stores the scale/position of the decimal point. This format can also overflow, and introduces accuracy trade-offs:
Possible combinations of a fixed number of bits show up throughout IT:
Shortening techniques: hexadecimal digits are used to represent binary values more compactly (since each hex digit represents exactly 4 bits) — this is why MAC addresses and colour codes (e.g. #FF5733) are written in hex rather than long binary strings.
💡 Exam Tip
Overflow error questions often ask you to calculate the valid range for a given number of bits and then explain what happens when a calculation exceeds it — memorise the two formulas above.