Number Systems

?

Naturals, Integers and Rationals

Natural Numbers

  • A positive whole number including zero

Integers

  • Any whole positive or negative number including zero

Rational Numbers

  • Any number that can be expressed as a fraction or ratio of integers
  • All integers are rationals
  • Denominator can't be zero else result is undefined
  •                Called divide by zero error and programmers must be aware not to fall into the trap
1 of 6

Irrationals, Reals, Ordinals and Cardinals

Irrational Numbers

  • Can't be represented as a ratio of integers as it would go on forever
  • An example is pi
  • Irrationals have no pattern after the decimal like recurring do.
  • Programmers need to decide how precise and how much memory we want when using these numbers.

Real Numbers

  • Any positive or negative number with or without a fractional part
  • Fractional part can be any length
  • Can be dealt with using fixed or floating point numbers.

Ordinal Numbers

  • Numbers used to identify position relative to other numbers (e.g. 1st, 2nd)

Cardinal Numbers

  • Numbers which identify size (e.g. in computing, identifying position in a  well ordered set)
2 of 6

Well Ordered Sets

S = {'Anne', 'Asif', 'John', 'Mary', 'Wanda',,,}

  • This set is well ordered as it has an internal structure that defines relationship between data items (e.g. alphabetical)
  • The ordinal number is the one that shows the order of the data set e.g. S(1) = 'Anne', S(2) = 'Asif' etc.
3 of 6

Uses in Programming

The use of natural numbers to count is common in programming

  • For example, a counter used in a for loop
  • To identify the location of an item in an array

The use of real numbers to measure is common in programming

  • For example, CNC (computer numerical control) machines handle measurements that vary from millimetres to metres and must work to a high degree of accuracy
  • Robotic engineers use real time measurements of the environment in which the robot is working.
4 of 6

Number Bases

Number Base- The number of digits available within a particular number system e.g base 10 for decimal, base 2 for binary.

Bit- A single binary digit from a binary number (either 0 or 1).

Byte- A group of 8 bits.

5 of 6

Units

Unit- Grouping together of bits or bytes to form larger blocks of measurement

Kilo = 100 times larger than single

KB = 1024 bytes (nearest binary equivalent of 1000)

Binary                                  Decimal

Kibibyte- Ki (2^10)               Kilobyte- KB (10^3) 

Mebibyte- Mi (2^20)            Megabyte- MB (10^6)

Gibibyte- Gi (2^30)              Gigabyte- GB (10^9)

Tebibyte- Ti (2^40)              Terabyte- TB (10^12)

6 of 6

Comments

No comments have yet been made

Similar Computing resources:

See all Computing resources »See all Number Systems resources »