Chapter Three Number System and Data Representation
Chapter Three Number System and Data Representation
Chapter Three Number System and Data Representation
A number system is a set of symbols used for counting. There are various number
systems
Ex. Decimal, Binary, octal-decimal, hexadecimal etc.
For the purpose of understanding how data are represented, stored and processed in
computer, we will discuss only two of them, the Decimal and the binary number system.
There are different number systems. Some of them are:-
It uses 16 symbols to represent numbers. But for the numbers greater than 15 they
represented in terms of the 16 symbols. for example the decimal number 16
represented as 10, 20 as 14, 30 as 1E and so on. These symbols are 0,1,…
9,A,B,C,D,E,F
When we compare the hexadecimal with decimal, 0-9 in hexadecimal is the same as
0-9 in decimal but 10 in hexadecimal is not the same as 10 in decimal,
Of course 10 in hexadecimal is equal to 16 in decimal because it holds the position of 16 in
decimal.
Example
DECIMAL OCTAL BINARY HEXADECIMAL
0 0 0 0
3 3 11 3
8 10 1000 8
10 12 1010 A
16 20 10000 10
The values that numbers have with a given number systems are largely determined by their
position. For example, the symbols 1 & 7 can represent either 17 or 71 depending upon their
relative position to one another.
The decimal number 135 may be expanded as:
2 1 0
(135) 10 = 1*10 +3*10 +5*10
The subscript 10 is used to indicate 135 is in base 10 number system.
The number 10 in binary is not the same as 10 in decimal because the
value of 1 in the binary is not the same as the value of the 1 in the
decimal.
The binary number 1101 may be expanded as
3 2 1 0
(1101)2 =1*2 +1*2 +0*2 +1*2
= (1*8) + (1*4) + (0*2) + (1*1)
= 8+4+0+1
= 1310
(Base10------------->BaseM)
To convert a binary number Y1Y2Y3Y4Yn.d1d2d3...dm to decimal first convert the integer part
to decimal by using
n-1 n-2 n-j 1 0
y1 y2 y3 y4…yn=y1*2 +y2*2 +….yj*2 +….+yn-1*2 +yn*2 =Q and convert the
fractional part to decimal by using
-1 -2 -3 -j -m
d1d2d3…dm=d1*2 +d2*2 +d3*2 +…+dj*2 +..+dm*2 =R
=110111101two =10011001two
To convert from Hexadecimal to binary convert each hex. Digit to its equivalent 4-bit
binary starting from right.
Ex. Convert 23416 to binary Convert 2AC to binary
23416 =0010 0011 0100 2AC16 =0010 1010 1100
= 10001101002 =10101011002
Binary Arithmetic
Computer understands only the language of binary numbers. Therefore, the machine performs
what is called binary arithmetic (binary computation).
Binary addition
Binary addition operates by the same rule as decimal addition, except that it is simpler. A carry to
the next higher order (or more significant) position occurs when the sum is decimal 2, that is,
binary 10. Therefore, the binary addition rules may be written as follows:
0+0=0
0+1=1
1+0=1
1+1=0 plus a carry of 1 into the next position
1+1+1=1 plus a carry of 1 into the next position.
The last case occurs when the two binary digits in a certain position are 1s and there is a carry
from the previous position.
Example1. 6+7 =13
110 ----> 6
+ 111 ----> 7
1101 ---->13
Example2. 19+31+10=60
10011------->19
+ 11111------->31
+ 1010------->10
111100 ------>60
Example1.
11100 28 101101 45 11001.011
- 11010 -26- 111 -7 - 111.110
00010 = 2 100110 = 38 10001.101
Binary Multiplication:
0x1=0
1x1=1
(b) Multiplying any number by 0 produces 0
0x0=0
1x0=0
Example1.
2*3=6
2=010 {010*011=?}
3=011
Binary division
That is, the process for dividing one binary number (the dividend) by another (the divisor) is
based on the rules for binary subtraction and multiplication and Similar to decimal division
Ex 1111101 11001
11001 101
11001
11001
00000
1111101 ÷ 11001 = 101
Data representation method
We enter data into a computer or review (see) output data from a computer using the
letter of alphabet, various special symbols, and the numerals in the decimal number
system. But since computer is an electronic device, which understands electrical flow
(signal) there is no letter, symbol or number inside the computer. Computer works with
binary numbers. As a semiconductor is conducting or isn’t conducting; a switch is closed
or opened.
The most elementary form to organize data within a computer (an electronic device) is in
the form of a code which utilizes the “ON” and “OFF” states of electric switches or there
is “current” and “no current” condition of the electronic components;
We see that the nature of the electronic devices has similarity with the binary number
system in that both represent only two elementary states;
It is therefore convenient to use binary number system to represent data in a computer;
An “ON” corresponds to a 1; an “OFF” corresponds to a 0;
In the computer “ON” is represented by the existence of a current and “OFF” is
represented by non existence of current
On a magnetic disk, the same information is stored by changing the polarity of
magnetized particles on the disk’s surface.
CODING METHODS
It is possible to represent any of the character in our language in a way as a series of
electrical switches in arranged manner;
These switch arrangements can therefore be coded as a series of equivalent arrangements
of bits
There are different coding systems, which convert one or more character sets into
computer codes. Some are: EBCDIC, BCD, ASCII-7 and ASCII-8.
In all cases, binary coding schemes separate the characters, known as character set, in to
zones. Zone groups characters together so as to make the coding scheme to decipher and
the data easier to process. With in each zone, the individual characters are identified by
digit code.
EBCDIC: Pronounced as “Eb-see-dick” and stands for Extended Binary Coded Decimal
Interchange Code.
Used usually for IBM Main frame model and in similar machines produced by other
manufacturer.
It is an 8-bit coding scheme: (00000000 – 11111111)
8
It accommodates to code 2 or 256 different characters
It is a standard coding scheme for the large computers.
Coding Example:
BCD (4 -bits)
The 4 bit BCD, which represent any digit of decimal number by four bits of binary
numbers.
If you want to represent 219 using 4 bit BCD you have to say 0010 0001 1001
♦ 4 bits BCD numbers are useful whenever decimal information is transferred into or
out of a digital system. Examples of BCD systems are electronic ousters, digital
voltmeter, and digital clocks; their circuits can work with BCD numbers.
♦ BCD’s are easy for conversion but slower for processing than binary. And they
have limited numbers because with BCD we can represent only numbers 0000 for 0
and 100 for 9 and ,1010,1011,1100,1101,1110, 1111 can’t be used because 1010
represent 10 in decimal at 10 in decimal is 1010 0000 in BCD.
The BCD equivalent of each decimal digit is shown in the following table:
Decimal BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
Note:
Each decimal digit is represented in BCD by 4 bits.
Example:
Convert 4210 in to BCD
= 01000010 in BCD
Note
Since 4 bits are used to represent a character, altogether only16 (24) configuration
is possible. Thus instead of using 4 bits with only 16 possible characters computer
designers commonly use 6 bits to represent characters in BCD. Now it is possible
to represent 64(26) characters.
Note:
Since we use 4 bits in BCD , altogether 16(24) configuration is possible
Activity
State the possible combinations of bits that can be formed in BCD code?
BCD (6-bits)
6
It uses 6-bits to code a Character (2 for zone bit and 4 for digit bit) it can represent 2 =
64 characters (10 digits, 26 capital characters and some other special characters).
BIT
Bits are the smallest units and can convey only two possible states 0 or 1;
Bit stands for binary digits;
A bit is a single element in the computer, on a disk that stands for either “ON”
indicating 1 or “OFF” indicating 0;
BYTE
Bits can be organized into large units to make them represent more and meaningful
information;
This large unit is called a byte and is the basic “unit of data representation” in a computer
system;
The commonly used byte contains 8 bits.
Since each bit has two states and there are 8 bits in a byte, the total amount of data that
8
can be represented is 2 or 256 possible combinations;
Each byte can represent a character (a character is either a letter, a number or a special
symbol such as +,-,?,*, $, etc
A byte is then used as a unit of measurement in the computer memory, processing unit,
external storage and during communication;
If the computer memory is 524288 byte, this is expressed in short by saying 512KB,
where KB stands for kilobyte.
1 Byte is 8 bits
10
1 Kilobyte (1KB) is 2 or 1024 bytes
20 10
1 Megabyte (MB) is 2 bytes or 2 kilobytes
30 20 10
1 Gigabyte (GB) is 2 bytes or 2 kilobytes or 2 megabytes
WORD
Word refers the number of bits that a computer process at a time or a transmission media
transmits at a time.