This chapter considers the three key number systems used in computer science, namely:
Binary
Denary / Decimal
Hexadecimal.
It also discusses how these number systems are used to measure the size of computer memories and storage devices, together with how sound and images can be represented digitally.
Binary represents data
As you progress through this course you will begin to realize the following:
How complex computer systems really are?
Have a better understanding of the fundamentals behind computers.
How sofware control computers.
Any form of data needs to be converted into a binary format(so that it can be processed by the computer).
No matter how complex the system, the basic building block in all computers is the binary number system.
This system is shosen because it only consists of 0s and 1s(Why because computers contain millions and millions of tiny switches they can be represented by the binary system. A switch in the ON position is represented by 1; a switch in the OFF position is represented by 0.)
The binary system
We are all familiar with the denary number system which counts in multiples of 10. This gives us the well-known headings of units, 10s, 100s, 1000s, and so on:
Denary uses ten separate digits, 0-9, to represent all values. Denary is known as a base 10 number system.
The binary number system is a base 2 number system. It is based on the number 2.
Thus, only the two ‘values’ 0 and 1 can be used in this system to represent all
values. Using the same method as denary, this gives the headings 20, 21, 22, 23,
and so on. The typical headings for a binary number with eight digits would be:
Converting from binary to denary
Convert the binary number, 11101110, into a denary number.
128 64 32 16 8 4 2 1
1 1 1 0 1 1 1 0
The equivalent denary number is 128 + 64 + 32 + 8 + 4 + 2 = 238
Convert the following binary number, 011110001011, into a denary number.
2048 1024 512 256 128 64 32 16 8 4 2 1
0 1 1 1 1 0 0 0 1 0 1 1
The equivalent denary number is 1024 + 512 + 256 + 128 + 8 + 2 + 1 = 1931
Converting from denary to binary
The conversion from denary numbers to binary numbers can be done in two different ways. The first method involves successive subtraction of powers of 2 (that is, 128, 64, 32, 16, and so on); whilst the second method involves successive division by 2 until the value “0” is reached.
Method 1
The denary number 142 is made up of 128 + 8 + 4 + 2 (that is, 142 – 128 = 14; 14 – 8 = 6;
6 – 4 = 2; 2 – 2 = 0; in each stage, subtract the largest possible power of 2 and keep
doing this until the value 0 is reached. This will give us the following 8-bit binary
number:
128 64 32 16 8 4 2 1
1 0 0 0 1 1 1 0
Method 2