Number Bases

We are used to working with the concept that there are 10 unique numerical digits, 0 to 9, however due to the boolean nature of logic circuits, computers tend to operate using just the digits 0 and 1, the binary number system.

Introduction to Number Bases

Denary – or base 10 – is the system we use naturally, we have 10 different digits from 0 to 9. Each digit in a denary number has a place value, calculated in powers of ten from the right hand side. For example, the number 52,451 can be expressed as:

$$!
= (5 \times 10000) + (2 \times 1000) + (4 \times 100) + (5 \times 10) + (1 \times 1) \\
= 52,451
$$

Other number bases work in exactly the same way, except rather than having powers of ten; we have powers of different numbers. In binary we have powers of two, and are restricted to two digits, 1 and 0. For example the number 11001101 can be evaluated in binary using the place value idea in the same way as for a denary number:

$$!
= (1 \times 128) + (1 \times 64) + (0 \times 32) + (0 \times 16) + (1 \times 8) + (1 \times 4) + (0 \times 2) + (1 \times 1)\\
= 205
$$

In hexadecimal, we use base 16 – with place value incrementing in powers of 16, and 16 possible digits. Since we have no more digits after 9, we use the letters A-F instead, whereby A is the digit which comes after 9, B is the digit which comes after A, etc. The number F616 can be evaluated in denary using the idea of place value:

$$!
= (F \times 16) + (6 \times 1)\\
= (15 \times 16) + (6 \times 1)\\
= 246
$$

The computer uses binary because it models the behaviour of a switch, it is either on or off, and the processor is only able to manipulate binary numbers. Hex is used because it is a very efficient system of storing large numbers, consider the number 255, this requires eight bits to store in binary (1111 1111), three to store in denary (255), but only two in hex (FF).

In Binary, special terms are given to groups of binary digits:

  • Each binary digit is known as a bit
  • 4 bits are known as a nibble
  • 8 bits are known as a byte
  • 16 bits are known as a half word
  • 32 bits are known as a word
  • 64 bits are known as a double word

Conversion Between Bases

You can use the place value system described in the previous section to convert numbers from any number base back into denary, and to convert from denary into other number bases there is a reverse process to use:

Whilst you can apply this method to any number base, including hexadecimal, it is usually easier to convert from denary to hexadecimal using binary as a go-between. Since the conversion from binary to hexadecimal is much easier. To now convert our 10110000 into hexadecimal, we just split it into blocks of four bits (known as a nibble) and convert these into hex digits. So 1011 becomes (8 + 2 + 1 = 11 = B) B, and 0000 is of course 0. So in hexadecimal 176 is equal to B0

References:
  • Janet Lavery – Durham University Computer Systems, Machine Architecture Lecture 5, 2007
  • A2 Computing Revision – Paul Nicholls – http://resources.r9paul.org/ASA2/Computing/A2ComputingRevision.pdf

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.