Skip to content
UoL CS Notes

Numbers & Number Types

COMP116 Lectures

What are Numbers?

Numbers are the objects that we use to count things. Depending on what we are counting we want to use different sets, or types, of numbers.

Sets of Numbers

  • $\Bbb N$:1,2,3,4… (Natural numbers)
    • Zero is not a part of this set.
  • $\Bbb W$:0,1,2,3,4… (Whole numbers)
  • $\Bbb Z$: …,-3,-2,-1,0,1,2,3… (Integers)
  • $\Bbb Q$: $\frac{1}{2},\frac{3}{4},\frac{2}{3},\frac{5}{8}$… (Rational)
\[\Bbb{N}\subseteq\Bbb{W}\subseteq\Bbb{Z}\subseteq\Bbb{Q}\]

All computers only use rational numbers.

Irrational Numbers

If we want to calculate things such as areas and lengths then we cannot guarantee that we will receive a rational number.

This set of numbers are called the Real Numbers ($\Bbb{R}$)

These numbers are modelled by data types such as float and double in high level languages.