Anda di halaman 1dari 3

Dr.S.J.M.Yasin/CE206_lecture_01_data_representation / 28-Mar-09/P-1 Dr.S.J.M.

Yasin/CE206_lecture_01_data_representation / 28-Mar-09/P-2

Data representation Now, it is understood that the more number of circuits we engage to
represent a number, the bigger number we can store. Also, the leftmost
In our familiar number system we have 10 symbols (0 to 9) to represent bit is reserved for sign. 8 bits (i.e. 8 circuits) make a unit of memory
a number. We call it decimal system or 10 base system. The place value which is called a byte. If we employ 2 bytes (16 bits) for a number then,
of a digit in this system is a multiple of 10x . For any other base value b, we will have 15 bits for digits and the largest number that can be stored
place value of a digit is bx. will be 215-1 = 32768. For 8 byte scheme 231 –1 = 2147483648
To process data in a computer, we need to represent them in the
We have already seen above how to convert binary number to its
registers of the processor. A register consists of several circuits.
decimal equivalent. We would like to briefly see how we can convert
Can we represent 10 symbols using an electric circuit? Obviously no.
any 10 base number to binary number.
We can symbolize an electric circuit into two states such as
(a) contains current
2 5208
(b) no current Thus (5208)10 = (1010001011000)2
2 2604 - 0
Similarly for a magnetic media such as a disk we may consider two 2 1302 - 0
states 2 651 - 0 check
(a) magnetized clockwise 2 325 - 1 (1010001011000)2
(b) magnetized counterclockwise
2 162 - 1 1 X 23 = 8
We may think these two states as two symbols (say one is 0 and the 2 81 - 0 4
1 X 2 = 16
2 40 - 1
other is 1) to represent a number. Thus we have only two digits to 1 X 26 = 64
represent a number in the computer processor, in the memory or in the 2 20 - 0
1 X 210 = 1024
data storage devices. Each individual circuit represents a digit and we 2 10 - 0
1 X 212 = 4096
term it as a bit (it is an abbreviation from binary digit). Thus, at circuit 2 5-0
level, we can represent a number in the computer in binary form. 2 2-1
in decimal 5208
1-0
As you all know, the largest number for a given number of digits can be
obtained by filling out each position with the largest symbol. Such as :
in decimal system, largest number with 3 digits = 999 Thus we can represent any integer number in binary, if sufficient bits
similarly, in binary, largest number with 3 digits = 111 are used.

What happens with non-integer (i.e. floating point) numbers?


(999)10 (111)2
0
9 X 10 = 9 1 X 20 = 1
9 X 101 = 90 (0.5)10 = (0.1)2
1 X 21 = 2 (0.5)10 = ? in binary
0.5
9 X 102 = 900 1 X 22 = 4 x2
in Check :
999 7 1.0 (0.1)2 = 1 x 2-1 = (0.5)10
decimal
(999)10 = 103 - 1 (111)2 = 23 - 1
0.8
0.4
1.2

0.4
1.2
1.6
1.6
0.8
0.4
0.2

x2
x2
x2
x2
x2
x2
x2
x2
x2
x2
0.1
(0.1)10 = ? in binary

(0.1)10

= (0.00011)2

point numbers are different.


= (0.00011001100110011..........)2

represent (0.1)10 exactly in binary and

can increase the accuracy by using


hence in the computer. However, we

than that for integer numbers. Also,


It is clear that it is never possible to

the scheme for integers and floating


more bits for floating point numbers
Dr.S.J.M.Yasin/CE206_lecture_01_data_representation / 28-Mar-09/P-3

Dr.S.J.M.Yasin/CE206_lecture_01_data_representation / 28-Mar-09/P-4

Data representation scheme for integer


0 1 2 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

Sign bit

Data representation scheme for floating point numbers

A floating point number is first converted to its equivalent in exponential form with the decimal point to the
leftmost significant digit. Such as :
57.234 = 0.57234 x 102 Exponent

Mantissa
0 1 2 3 . . . . . . . .7. 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

7 bit 56 bit for mantissa


for exponent
Sign bit
Dr.S.J.M.Yasin/CE206_lecture_01_data_representation / 28-Mar-09/P-5 Dr.S.J.M.Yasin/CE206_lecture_01_data_representation / 28-Mar-09/P-6

Character representation

Besides numbers we have to represent / store character and other


symbols in the computer. Usually they are coded in 8 bit words.
0 0
If we use 8 bits, we can store numbers ranging from 1 1
2 10
(00000000)2 --> decimal equivalent 0 . 11
(11111111)2 --> decimal equivalent --> 28-1= 255 . .
9 .
So 256 symbols may be coded. 10 100
11 101
From the above discussion it should be understood that different types . .
of data are stored using different scheme. So before we store any data, . .
we have to specify the type of the data. 99 111
100 1000
101 .
. 1111
. 10000
999

Anda mungkin juga menyukai