Lec9!10!11 Data Representation
Lec9!10!11 Data Representation
Data Representation
(Machine level -
representation-number
system)
DATA REPRESENTATION IN A COMPUTER
1. Introduction
• Computers are classified according to functionality, physical size
and
purpose.
• Functionality, Computers could be analog, digital or hybrid.
Digital computers process data that is in discrete form whereas
analog computers process data that is continuous in nature.
Hybrid computers on the other hand can process data that is
both discrete and continuous.
• In digital computers, the user input is first converted and
transmitted as electrical pulses that can be represented by two
unique states ON and OFF. The ON state may be represented by
a “1” and the off state by a “0”.The sequence of ON’S and OFF’S
forms the electrical signals that the computer can understand.
• A digital signal rises suddenly to a peak voltage of +1 for some time
then
suddenly drops -1 level on the other hand an analog signal rises
to +1 and then drops to -1 in a continuous version.
• The laser beam reflected from the land is interpreted, as 1.The laser
entering the pot is not reflected. This is interpreted as 0.The
reflected pattern of light from the rotating disk falls on a receiving
photoelectric detector that transforms the patterns into digital form.
The presence of a magnetic field in one direction on magnetic media
is interpreted as 1; while the field in the opposite direction is
interpreted as “0”.Magnetic technology is mostly used on storage
devices that are coated with special magnetic materials such as iron
oxide. Data is written on the media by arranging the magnetic
dipoles of some iron oxide particles to face in the same direction
and some others in the opposite direction
2
Bits, bytes, nibble and word
• The terms bits, bytes, nibble and word are used widely in
reference to computer memory and data size.
• Word: two or more bits make a word. The term word length is
used as the measure of the number of bits in each word. For
example, a word can have a length of 16 bits, 32 bits, 64 bits etc.
4
1002.
5
Binary number system
It uses two digits namely, 1 and 0 to represent numbers. unlike in
decimal numbers where the place value goes up in factors of ten, in
binary system, the place values increase by the factor of 2.binary
numbers are written as X2.consider a binary number
such as 10112.The right most digit has a place value of 1×20 while
the left most has a place value of 1×23.
6
• For example, a number system can be used to represent the
number of students in a class.
• Its base is 2
7
• Combination of binary numbers used to represent different quantities
like 1001
8
• Consists of 10 digits from 0 to 9
• The leftmost digit of a number has the highest weight. This digits is
9
2. CONVERSION
There are about 12 conversions because we can convert each
number system in other number system.
2. Decimal--------------Octal
3. Decimal--------------Hexadecimal
4. Binary----------------Decimal
5. Binary Octal
6. Binary----------------Hexadecimal
7. Octal-------------------Decimal
8. Octal Binary
9. Octal-------------------Hexadecimal
10. Hexadecimal-------Decimal
11. Hexadecimal-------Binary
12. Hexadecimal-------Octal
EXAMPLES
1
1.DECIMAL TO
BINARY 1. (88)10
(?)2
2 88
2 44 - 0
2 22 - 0
2 11 - 0
2 5 -1
2 2 -1
2 1 -0
0 -1
(1011000)2
OR
1
2 88
2 44 - 0
2 22 - 0
2 11 - 0
5 -1
2 2 -1
1 -0
(1011000)2
1
2.DECIMAL TO OCTAL
1.(119)10----- (?)8
8 119
8 14 - 7
8 1-6
8 0-1
(0167)8
8146
818 - 2
8 2-2
0-2
(0222)8
3.Decimal to Hexadecimal
1. (185)10-------------(?)16
16185
1611 - 9
160 - 11
(B9)16
2.1.1. Converting Fractional Decimal
Number to Octal Number
Multiply the fraction part of decimal number with the
base of the system in which fraction is to be converted.
The result may have two parts i.e. integer part and fraction
part.
Multiply the resulting fraction with the base again.
Repeat minimum 5 steps.
The integral part is written as answer, from top to bottom.
EXAMPLE
S
1.(0.3)10-----------------()8
(0.23146)8
830 - 0
83 - 6
8 0-3
(0360)8
1
Steps Result Fractional Integral part
Part
.36 * 8 2.88 .88 2
.88 * 8 7.04 .04 7
0.4 * 8 0.32 .32 0
0.32 * 8 2.56 .56 2
0.56 * 8 4.48 .48 4
0.48 * 8 3.84 .84 3
(270243)8
(240.36)10 = (0360.270243)8
1
2 5–1
1
2 2-1
2 1–0
2 0-1
(01011101
11)2
1
(100011)2
(.4CC)16
EXAMPL
ES 1. (11001)2--(?)10
11001= 1*24+1*23+0*22+0*21+1*20
= 16 + 8 + 1
1
= 25
= (25)10
EXAMPLE
1.(101. 111)2
1* 22+ 0*21+1*20+1*2-1+1*2-2+1*2-3
= 4 + 0+ 1+1/2+1/4+1/8
= 5 + .875
= (5.875)10
0 0 0 1 1
0 0 1 0 2
1
0 1 1 1 3
0 1 0 0 4
0 1 0 1 5
0 0 1 0 6
0 0 1 1 7
1 0 0 0 8
1 1 0 1 9
1 1 1 0 10 = A
1 1 1 1 11 = B
1 0 0 0 12 = C
1 0 0 1 13 = D
1 0 1 0 14 = E
1 1 1 1 15 = F
EXAMPL
ES 1.(100101110)2
---------------------------
(?)8
1
2
From table we write the values against each number.
4 5 6 (from
table) (456)8
2. (1001.01110)2 = (?)8
001 001 . 011 100
1 1 . 3 4
EXAMPLES
1. (0010110001101011)2 = (?)16
2
0010 1100 0110 1011
2 C 6 B (from table)
(2C6B)16
EXAMPLES
1. (456)8 = (?)2
4 5 6
100 101 110 (from table)
(456)8 = (100101110)2
EXAMPL
ES 1.(2C6B)16 =
(?)2
2
2 C 6 B