You are on page 1of 8

Chapter 3

DATA REPRESENTATION
Digital Number Systems
In digital systems like computers, the quantities are represented by symbols called
digits. Many number systems are in use in digital technology that represents the digits in
various forms. The most common are:
(1) Decimal Number System
It is composed of 10 numerals or symbols because of this; the base of this number
system is 10. This is also known as base-10 system because it has 10 digits. These 10
symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. It is positional value system in which the value
of a digit depends on its position. For example, in decimal number 729, 7 represents
7 hundreds, the 2 represents 2 tens, and the 9 represents 9 units. In this, 7 carry the
most weight of three digits; it is referred to as the most significant digit (MSD). The
9 carry the least weight and is called the least significant digit (LSD).

(2) Binary Number System


It is composed of 2 numerals or symbols because of this; the base of this number
system is 2. This is also known as base-2 system because it has 2 digits. These 2
symbols are 0 and 1.

(3) Octal Number System


It is composed of 8 numerals or symbols because of this; the base of this number
system is 8. This is also known as base-8 system because it has 8 digits. These 8
symbols are 0, 1, 2, 3, 4, 5, 6, 7.
1
Page
(4) Hexadecimal Number System
It is composed of 16 numerals or symbols because of this; the base of this number
system is 16. This is also known as base-16 system because it has 16 digits. These 16
symbols are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

Number Conversions
(1) Decimal-to-Binary Conversion
There are two procedures for converting (Integers) from decimal to binary:
(i) Referring to Table of Powers

(ii) Repeated Division Method by base 2 and Multiply fractional part by 2 &
store the Integral part, read them from top to bottom.

2 43 1 LSB
2 21 1
2 10 0
2 5 1
2 2 0
2 1 1
0 MSB
2

Reading the remainders from bottom to the top,


Page

4310 = 1010112 (Compare with result of above method)


Convert 0.375 Integral Part
Multiply (fraction part) 0.375 by 2 = 0.750 0
Multiply (fraction part) 0.75 by 2 = 1.50 1
Multiply (fraction part) 0.5 by 2 = 1.0 1

Reading Integral part from top to bottom,


0.37510 = 0.0112

(iii) Binary-to-Decimal Conversion


Multiply each binary digit by its position values in terms of 2 raise to the power and
add them.
For example,

(iv) Decimal-to-Octal Conversion


Using repeated division method by base 8 for integers and Multiply fractional part
by 8 & store the Integral part, read them from top to bottom.
For example,
Convert 266.37510 to octal.
It will be done in two part :-
Firstly Convert 266

8 266 2 LSB
8 33 1
8 4 4
0 MSB

Secondly Convert 0.375 Integral Part


Multiply (fraction part) 0.375 by 8 = 3.0 3

Now, Reading the remainders from bottom to the top for 266 and reading Integral
part from top to bottom for 0.375. Hence,
266.37510 = 412.38

(v) Octal-to-Decimal Conversion


Multiply each octal digit by its position values in terms of 8 raise to the power and
3

add them.
Page

For example,
(vi) Octal-to-Binary Conversion
The conversion from octal to binary is performed by converting each octal digit to
its 3-bit binary equivalent. Binary equivalents of octal digits given below in the
table:-

Octal Digit 0 1 2 3 4 5 6 7
Binary
000 001 010 011 100 101 110 111
Equivalent

For example, Convert 4728 to binary as follows:


4 7 2

100 111 010


Hence, octal 472 is equivalent to binary 100111010
As another example, 3.168 to binary as follows:
3 1 6

010 001 110


3.168 = 010.001110
Hence, octal 3.16 is equivalent to binary 10.00111

(vii) Binary-to-Octal Conversion


To convert binary to octal, the bits of the binary integer are grouped into groups of
three bits starting at the LSB. Then each group is converted to its octal equivalent.
To illustrate, consider the conversion of 1001110102 to octal.
100 111 010

4 7 2
Hence, 1001110102 = 4728
To illustrate, consider the conversion of 1101.01112 to octal.
001 101 011 100

1 5 3 4
Hence, 1101.01112 = 15.348

(viii) Decimal-to-Hexadecimal Conversion


Using repeated division method by base 16 and multiply fractional part by 16 &
4

store the Integral part, read them from top to bottom.


Page

For example, convert 423.0312510 to hexadecimal number,


It will be done in two part :-
Firstly Convert 423

16 423 7 LSB
16 26 A
16 1 1
0 MSB

Secondly Convert 0.01325 Integral Part


Multiply (fraction part) 0.01325 by 16 = 0.5 0
Multiply (fraction part) 0.5 by 16 = 8.0 8

Now, Reading the remainders from bottom to the top for 423 and reading Integral
part from top to bottom for 0.01325. Hence,
423.0132510 = 1A7.0816

(ix) Hexadecimal-to-Decimal Conversion


Multiply each octal digit by its position values in terms of 16 raise to the power and
add them.
For example,
56.0816 = 5 x 161 + 6 x 160 + 0 x 16-1 + 8 x 16-2
= 80 + 6 + 0 + 8/256
= 86+0.03125
= 86.0312510
(x) Binary-to-Hexadecimal Conversion
To convert binary to hexadecimal, the bits of the binary integer are grouped into
groups of four bits starting at the LSB. Then each group is converted to its
hexadecimal equivalent. To illustrate, consider the conversion of 100111010 2 to
hexadecimal.
0001 0011 1010

1 3 A
Hence, 1001110102 = 13A16
To illustrate, consider the conversion of 101101.0111012 to hexadecimal.
0010 1101 0111 0100

2 D 7 4
Hence, 101101.0111012 = 2D.7416

(xi) Hexadecimal-to-Binary Conversion


The conversion from hexadecimal to binary is performed by converting each
hexadecimal digit to its 4-bit binary equivalent. Binary equivalents of hexadecimal
5

digits given below in the table:-


Page
Hexadecimal
0 1 2 3 4 5 6 7
Digit
Binary
0000 0001 0010 0011 0100 0101 0110 0111
Equivalent

A B C D E F
Hexadecimal
8 9 means means means means means means
Digit
10 11 12 13 14 15
Binary
1000 1001 1010 1011 1100 1101 1110 1111
Equivalent

For example, Convert 8B616 to binary as follows:


8 B 6

1000 1011 0110


Hence, hexadecimal 8B6 is equivalent to binary 100010110110
As another example, 3.1C16 to binary as follows:
3 1 C

0010 0001 1100


3.1C16 = 0010.00011100
Hence, hexadecimal 3.1C is equivalent to binary 10.000111

Binary Representation of Integers:-


(i) Sign and Magnitude representation
Integers are identified by their signs (+ or –) and a string of digits which
represent the magnitude. The Most Significant Bit (MSB) is representing sign.
Total numbers which can be represented by N bit word. Using sign and
magnitude representation are 2N–1. For example, if in a computer, the word size
is 1 byte (8 bits), then

An 8 bits word can represent total 28 – 1 = 255 numbers i.e., -127 to 0 and 0 to
+128.
6
Page
(ii) One’s Complement representation
To calculate 1’s complement of a binary number, just replace every 0 with 1 and
every 1 with 0. For example, 1’s complement of binary number 1001 will be
0110.
Total numbers which can be represented by N bit word. Using One’s
Complement representation is 2N–1.
For example, Express –13 in One’s Complement form in 8-bit.
+13 = 0000 1101
–13 = 1111 0010

(iii) Two’s Complement representation


To calculate 2’s complement of a binary number is calculated by adding 1 to its
1’s complement. For example, 2’s complement of binary number 1001 will be
calculated as:
1’s complement of 1001 = 0110
+1
2’s complement of 1001 = 0111

(Binary Addition rules are 0 + 0 = 0; 0 + 1 = 1; 1 + 0 = 1; 1 + 1 = 10; 1 + 1 + 1 = 11)


Total numbers which can be represented by N bit word. Using Two’s
Complement representation is 2N.
For example, Express –17 in Two’s Complement form in 8-bit.
+13 = 0001 0001
1’s Complement = 1110 1110
Add 1 = 1110 1111
Now, 2’s Complement of –17 is 1 1 1 0 1 1 1 1

ASCII:-
It stands for American Standard Code for Information Interchange. This is seven bit
code capable of coding 27 = 128 characters. This is more than enough to represent all of the
standard keyboard characters as well as control functions. ASCII is used in most
microcomputers and minicomputers and in many mainframes. For example, what is the
following message which is encoded in ASCII code?
1001000 1000101 1001100 1010000
Solution:-
Convert each 7-bit code to its Decimal Equivalent. The results are
1001000 1000101 1001100 1010000
72 69 76 80
H E L P
Hence, the message is HELP.

ISCII:-
It stands for Indian Standard Code for Information Interchange. This is eight bit code
capable of coding 256 characters. It retains all ASCII characters and offers coding for Indian
7

Scripts also. ISCII has been used by IBM for PC-DOS,


Page
UNICODE:-
Unicode provides a unique number for every character,
no matter what the platform,
no matter what the program,
no matter what the language,
Indian languages in UNICODE are Devnagri, Bengali, Gujarati, Tamil, Telgu etc.
UNICODE version 3.0 represented 49,194 characters whereas UNICODE version 3.1
represented 94,140 characters

Significance of UNICODE:-
(i) It enables a single software product or a single website to be targeted across
multiple platforms, languages and countries without re-engineering.
(ii) It allows data to be transported through many different systems without
corruption.

8
Page

You might also like