Skip to content

C1 · Number Systems

Spec reference: Section C1 - How Data is Represented Key idea: Understand binary, BCD, and how to perform binary arithmetic including negative and floating point numbers.


Units of digital data

UnitSize
BitSingle binary digit: 0 or 1
Nibble4 bits
Byte8 bits
Kilobyte (KB)1,024 bytes
Megabyte (MB)1,024 KB
Gigabyte (GB)1,024 MB
Terabyte (TB)1,024 GB

Number systems

Binary (Base 2)

Uses only 0 and 1. Each position is a power of 2.

1286432168421
01011001

This binary number = 64 + 16 + 8 + 1 = 89

Hexadecimal (Base 16)

Uses digits 0-9 and letters A-F. Each hex digit represents 4 bits (a nibble).

HexBinaryDecimal
0-90000-10010-9
A101010
B101111
C110012
D110113
E111014
F111115

Used in memory addresses, colour codes (HTML), and MAC addresses because it is more compact than binary.

Binary Coded Decimal (BCD)

Each decimal digit is stored as its 4-bit binary equivalent.

Example: 47 in BCD:

  • 4 = 0100
  • 7 = 0111
  • BCD representation: 0100 0111

Used in systems where exact decimal representation is important, such as financial systems and digital clocks.


Binary arithmetic

Addition

Rules: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (write 0, carry 1), 1+1+1=11 (write 1, carry 1)

  0 1 1 0 1  (13)
+ 0 0 1 1 1  ( 7)
-----------
  1 0 1 0 0  (20)

Subtraction

Using two's complement (see below) is the standard method.

Multiplication

Shift left and add. Multiplying by 2 is a single left shift.

Division

Shift right and subtract. Dividing by 2 is a single right shift.


Representing negative numbers: Two's Complement

Two's complement is the standard way computers represent negative integers.

To convert a positive binary number to its negative equivalent:

  1. Invert all bits (flip 0s to 1s and 1s to 0s).
  2. Add 1 to the result.

Example: Represent -6 in 8-bit two's complement.

  1. +6 in binary: 0000 0110
  2. Invert: 1111 1001
  3. Add 1: 1111 1010

So -6 = 1111 1010 in two's complement.

The most significant bit (MSB) acts as the sign bit: 0 = positive, 1 = negative.

| 8-bit two's complement range | -128 to +127 |


Floating point numbers

Floating point allows computers to represent very large or very small numbers.

A floating point number has two parts:

  • Mantissa: The significant digits.
  • Exponent: The power of 2 by which the mantissa is multiplied.

Example (simplified): The number 0.001011 x 2^5 in normalised form:

  • Mantissa: 0.101100
  • Exponent: 5

Exam point

Normalised floating point means the mantissa is adjusted so the first significant digit is immediately after the binary point (for positive: 0.1..., for negative: 1.0...). This maximises precision.

Trade-offs:

  • More bits for the mantissa: greater precision.
  • More bits for the exponent: greater range.
  • Rounding errors occur because not all decimal values can be represented exactly in binary floating point.

Summary

TermMeaning
BitThe smallest unit of data, 0 or 1
Two's complementMethod for representing negative integers in binary
BCDEach decimal digit stored as 4 binary bits
MantissaThe significant digits in a floating point number
ExponentThe power applied to the mantissa in floating point
OverflowWhen a result is too large to be stored in the available bits

Test Yourself

Ad

PassMaven - revision made simple.