The Number System CS
The Number System CS
SYS TEM
SAI N K O R I R
BY: MR H US
8
CT:071498098
CONTA
INTRODUCTION
Data is information coded in a format ready for processing.
Data is raw facts and figures and can be in the form of numbers, symbols or alphanumeric characters before processing. .
As humans we use analogue data, such as sound or light waves and impulses on our skin. Everything we see
and hear is a continuous transmission of analogue data to our senses.
Analogue data is great for us as we can process and understand it.
Computers cannot process analogue data, they are only capable of processing digital data. Any data that we want a computer to
process must first be converted into digital data, This is data represented in the values 1 and 0 that a computer can process.
Binary number system uses only two digits that are 0 and 1.
All the computers and electronic devices are using it for their internal processing.
Binary numbers are also called the base 2 number system. It can be written as (101010)2.
Since 8 digits are used, it is also called the base 8 number system.
Every number (value) represents with 0,1,2,3,4,5,6 and 7 in this number system.
The base of octal number system is 8 because it has only 8 digits. It can be written as (76401)8
CONVERSION TABLE
CONVERTING BINARY(BASE2) TO DENARY(BASE 10)
Computers use switches to store data and these switches can be in one
of two states: on or off.
Because of this we need to convert all data and instructions into binary,
which can represent on or off using the two digits 0 and 1 (Zero = Off)
(One=On)
■ Each stored binary digit is called a bit (binary digit). Example 0 and
1(1 is a bit) (0 is a bit) (10= 2bits)
■ A group of 8 bits is called a byte. example 11110000
■ Half a byte, 4 bits, is called a nibble . Example: 1111
128 64 32 16 8 4 2 1
MSB LSB
The column values are ten times larger than the previous value as we move from right to left; that is, the ‘hundreds’ are ten
times bigger than ‘tens’ and ‘tens’ are ten times bigger than ‘ones’.
In binary we just have the two symbols or values, 0 and 1. This means that in the binary number system each column
heading is twice as big as the previous one as we move from right to left The column headings in binary, from right to left,
are ‘ones’, ‘twos’, ‘fours’, ‘eights’ and so on. The leftmost digit in a binary number is called the most significant bit (MSB) and
the rightmost digit the least significant bit (LSB). In an 8-bit number, the MSB has decimal value of 128 and the LSB has
decimal value of 1.
HOW TO CONVERT DENARY NUMBERS INTO 8-BIT BINARY NUMBERS AND VICE VERSA
Method1
column value.
We take that remainder and then check if it is smaller than the next
column value, and repeat the process above. We continue this process
Using the same method as for denary and binary, this gives the
headings 160, 161, 162, 163, and so on.
The typical headings for a hexadecimal number with five
digits would be: Example :2 1 F 3 A
65536(164) 4096(163) 256(162) 16(161) 1(160)
2 1 F 3 A
Converting from binary to hexadecimal and from hexadecimal to binary
Converting from binary to hexadecimal is a fairly easy process.
Starting from the right and moving left, split the binary
number into groups of 4 bits.
If the last group has less than 4 bits, then simply fill in with 0s
from the left.
Take each group of 4 bits and convert it into the equivalent
hexadecimal digit using Table
Example 1
Convert 1 0 1 1 1 1 1 0 0 0 0 1 to Hexadecimal
First split this up into groups of 4 bits:
1011 1110 0001
Find the value of each grouped binary digits in decimal/denary
1011=11 1110=14 00001=1
Then, using Table <find the equivalent hexadecimal digits of
11, 14 and 1
Answer :11=B , E=14 and 1=1
1011,1110,0001=BE1
CONVERTING FROM HEXADECIMAL TO DENARY
16 and 1.
heading values.
multiplication.
Example 1
Convert the hexadecimal number, 4 5 A, into denary.
First of all we have to multiply each hex digit by its heading value:
256 16
1
4 5
A
Then we have to add the three totals together (1024 + 80 + 10) to give the
denary number:
1114
CONVERT DENARY TO HEXADECIMAL
To convert a denary value to hexadecimal, you :
first convert the number to binary using the method outlined previously.
Once you have this binary number, you can split it into two nibbles – 4 bits each.
This is because 4 bits can be used to represent values from 0–15
– the same values represented by a single hexadecimal digit.
For example, let us take the number 222, which converts to binary number
11011110
If you apply place values on a ‘per-nibble’ basis, you end up with the above. You
can then translate each nibble to a corresponding denary value, and finally convert
this to hexadecimal.
For example, nibble 1 is equal to denary 13 (hexadecimal D ),
and nibble 2 is equal to denary 14 (hexadecimal E ).
So our resulting hexadecimal number is DE
WHY IS HEXADECIMAL USED IN COMPUTER SCIENCE.
Programmers often use hexadecimal when writing and analyzing computer programs. They do this because it is easy for a human to read
hexadecimal, rather than binary.
For example, if a programmer looked at a set of data that is stored in registers, as binary it could look like this:
10011100101110111000111011100010111101011010
The programmer may be trying to find out if the data stored matches the correct data
which should be:
10011100101110111001011011100010111101011010
At a glance, it is difficult to see whether the two values match or if an error has occurred.
If that stored data is represented in hexadecimal it would be:
9CBB8EE2F5A
Comparing it to the correct value that should be:
9CBB96E2F5A
It is much easier to see that the data does not match, and the programmer can identify that an error has occurred.
The benefits of using hexadecimal rather than binary for a programmer are:
• Hexadecimal is a shorter way of representing binary, so it takes up less space on the computer screen or piece of paper.
• Hexadecimal is easier for a programmer to read, write and understand.
• Hexadecimal is easier to debug and locate errors in data.
EXAMPLES OF THE USE OF HEXADECIMAL NUMBERS IN DATA REPRESENTATION
Data in its most basic form has to be converted to binary so it can be processed by a computer. However hexadecimal
numbers are useful for a number of purposes, and are easier for humans to read than long strings of binary bits
Hexadecimal numbers can be found in computer science in the following examples:
Error codes
Often operating system errors are represented with hexadecimal numbers for reference.
0xC00D0803L
For example:
00 – 1C – B3 – 4F – 25 – FE is the MAC address of a device produced by the Apple Corporation (code: 001CB3) with a serial number of:
4F25FE. Very often lowercase hexadecimal letters are used in the MAC address: 00-1c-b3-4f-25-fe. Other
manufacturer identification numbers include:
00 – 14 – 22 which identifies devices made by Dell
00 – 40 – 96 which identifies devices made by Cisco
00 – a0 – c9 which identifies devices made by Intel, and so on
INTERNET PROTOCOL (IP) ADDRESSES
Each device connected to a network is given an address known as the Internet Protocol (IP) address. An IPv4 address is a 32-bit number
written in denary or hexadecimal form: e.g. 109.108.158.1 (or 77.76.9e.01 in hex). IPv4 has recently been improved upon by the adoption of
IPv6. An IPv6 address is a 128-bit number broken down into 16-bit chunks, represented by a hexadecimal number. For
example:a8fb:7a88:fff0:0fff:3d21:2085:66fb:f0fa >>IPv6 uses a colon (:) rather than a decimal point (.) as used in IPv4.