0% found this document useful (0 votes)
33 views14 pages

Data Representation and Number Systems

Notes of computer data representation
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views14 pages

Data Representation and Number Systems

Notes of computer data representation
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Page 1 Unit-A, Chapter 03, Data Representation

UNIT -A
CHAPTER-3
DATA REPRESENTATION

CONTENTS
 NUMBER SYSTEM
 POSITIONAL and NON-POSITIONAL NUMBER SYSTEM
 TYPES OF POSITIONAL NUMBER SYSTEM
 Decimal number system.
 Binary numbers system.
 Octal number system.
 Hexadecimal numbers system.
 CONVERSION FROM ONE NUMBERS SYSTEM TO ANOTHER NUMBER SYSTEM
a) Conversion from Decimal to Binary, Octal, Hexadecimal.
b) Conversion from Binary, Octal, Hexadecimal to Decimal.
c) Conversion from Binary, Octal, Hexadecimal to Binary, Octal, Hexadecimal
 BINARY ARITHM ETIC
1) Binary addition.
2) Binary subtraction.
3) Subtraction using 1’s complement.
4) Subtraction using 2’s complement.
 REPRESENTATION OF SIGNED NUMBERS
 COM PUTER CODES
BCD, EXCESS-3 BCD, EBCDIC, ASCII code.

INTRODUCTION
Computer manipulates a different types of data such as letters (A-Z), digits (0-9), special
character (+,-,*,/,#…) and so on. Internally these different types of data stored, represen te d an d
manipulated with the use of suitable codes called binary codes.
Before understand the formation of binary codes i t is necessary for us to understand the variou s
number system.

Number: Is a symbol which holds certain values and have predefined meaning.
Ex: 5five
6six
7seven

Numbers system are classified into two types


1. Non-positional number system
2. Positional number system.

1. Non-positional number system


In early days, the peoples were use their fingers for counting purpose, ten fingers was not
enough for counting they started using pebbles, stones and sticks which indicate value.
Five objects are represented by five stones or sticks (*****= 5 stones). So the overall value is
the sum of all individual elements is called non-positional number system.

Ex: Roman numbers system. It provides a partial solution to the problem of representing
large number. I =1, II=2, V=5, X=10, L=50

The number 55 is represented in roman number system as LV. This number syste m c an n ot
be used effectively to perform arithmetic operations.

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 2 Unit-A, Chapter 03, Data Representation

2. Positional number system:


It uses a certain well defined symbols called digits. The value of each digit depends on the
position in which they appear in the number.
The value of each digit is depending on three factors.
 The digit itself.
 Position of the digit in the number.
 Base of the number system.

Ex: Decimal number system 538


Position of 5=hundredth
3=tens
8=unit

Four types of positional number system.


1. Decimal number system.
2. Binary number system.
3. Octal number system.
4. Hexadecimal number system.

1. Decimal number system: The base of decimal number system is 10. It has ten symbols from
0-9. The position of each decimal integer and decimal fraction is represented as posi ti ve an d
negative power of 10.
Ex: (538.45)10

2. Binary number system: The base of binary number system is 2. It has two symbols 0’s and
1’s. The position of each binary bit is represented as a positive and negative power of 2.
Ex: (1010.11)

3. Octal number system: The base of octal number system is 8. It has eight symbols from 0-7.
The position of each octal integer and octal fraction is represented as positive and negative
power of 8.
Ex: (426.47)8

4. Hexadecimal number system: The base of hexadecimal number system is 16. It has sixteen
symbols from 0-9 and A-F. The decimal equivalent of A B C D E and F is 10 11 12 13 14 an d
15 respectively. The position of each hexadecimal integer and fraction is represented as
positive and negative power of 16.
Ex: (BAD.45)16 decimal equivalent of B A D is 12 11 14

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 3 Unit-A, Chapter 03, Data Representation

NOTE:
 Base or Radix of number system: Is defined as a total number of symbols or digits
available in the number system.
 MSD (Most Significant Digit): Left most digits have highest value.
 LSD (Least Significant Digit): Right most digits have least value.
 MSB (Most significant Bit): Left most bits have highest value.
 LSB (Least significant Bit): Right most bits have a least value.

The following table shows various decimal numbers and their Binary, Octal and
Hexadecimal equivalent.
DECIMAL BINARY OCTAL HEXADECIMAL
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

Number system conversions.


1. Conversion from Decimal to Binary, Octal and Hexadecimal number system.
2. Conversion from Binary, Octal and Hexadecimal to Decimal number system.
3. Conversion from Binary, Octal, Hexadecimal to Binary, Octal, Hexadecimal number syste m
other than decimal.

1. Conversion from Decimal To Binary, Octal and Hexadecimal number system.


a) Conversion from Decimal integer To Binary, Octal and Hexadecimal number system
(32)10 = (?)2= (?)8 = (?)16
Rules
 Repeatedly divide the decimal intege r by the base of binary, octal and hexadecimal
number system.
 Note down the remainder for each division until the quotient becomes 0.
 The result is obtained by reading it from bottom to top (ie, 1st reminder as LSD an d l ast
reminder as MSD).

b) Conversion from Decimal fraction To Binary, Octal and Hexadecimal number system
(0.125)10 = (?)2= (?)8 = (?)16
Rules
 Repeatedly multiply the decimal fraction by the base of binary, octal and hexadecimal
number system.
 Note down the integer part for each multiplication until the fractional part becomes 0.

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 4 Unit-A, Chapter 03, Data Representation

 The result is obtained by reading it from top to bottom (ie, 1 st integer as MSD and Last
integer as LSD.
Ex:
i. Decimal integer to Binary, Octal and Hexa-decimal.
 (32)10 = (?)2 = (?)8= (?)16

Home work:
1) (61)10 = (?)2 = (?)8= (?)16
2) (128)10 = (?)2 = (?)8 = (?)16
3) (205)10 = (?)2 = (?)8 = (?)16

ii. Decimal fraction to Binary, Octal and Hexa-decimal.


 (0.125)10 = (?)2 = (?)8= (?)16

Home work:
1) (0.25)10 = (?)2 = (?)8 = (?)16
2) (0.125)10 = (?)2 = (?)8 = (?)16
3) (29.25)10 = (?)2 = (?)8 = (?)16

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 5 Unit-A, Chapter 03, Data Representation

 (61.75)10 = (?)2 = (?)8 = (?)16

2. Conversion from Binary, Octal and Hexadecimal To Decimal number system.


 Determine the position value of each digit.
 Multiply the obtained value with the digit in the corresponding position.
 Sum all the obtained value to get the decimal equivalent.

Ex: Binary, Octal, Hexa-decimal Integer and fraction to Decimal number.

 Binary to decimal (100000.11)2= (?)10

 Octal to decimal (200.2)8 = (?)10

 Hexa-decimal to decimal (CD.2)16= (?)10

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 6 Unit-A, Chapter 03, Data Representation

Home work
1) (100010.111)2 = (?)10
2) (75.5)8 = (?)10
3) (29.2)16 = (?)10

3. Conversion from Binary, Octal, Hexadecimal To Binary, Octal and Hexadecimal


number system (from any other number system to any other number system other
than Decimal number system).
 First convert the Binary or Octal or Hexadecimal to Decimal number system.
 Convert the obtained Decimal number into specified number system
Ex:
 Binary to Octal and Hexa-decimal
(100000)2 = (?)8 = (?)16

 Octal to Hexadecimal and Binary


(75)8 = (?)16 = (?)2

 Hexadecimal to Binary and Octal


(BAD) 16 = (?)2 = (?)8

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 7 Unit-A, Chapter 03, Data Representation

Short cut method to convert Binary, Octal, Hexadecimal to Binary, Octal, Hexadecimal

Binary arithmetic:
The processes of performing arithmetic operation s on two binary numbers are called binary
arithmetic.

Classification of binary arithmetic.


Binary addition: The process of finding the sum of two binary numbers is called binary
addition.
Rules
B1 B2 B3 Carry Sum
0 0 - 0 0
0 1 - 0 1
1 0 - 0 1
1 1 - 1 0
1 1 1 1 1
B1, B2 , B3 are the bit numbers.

Ex: Find Binary addition for the following.


1) (1110011)2 + (0101111)2

2) (12)10 + (10)10

One’s complement of binary number:


The one’s complement of binary number is obtained by changing each 0’s to 1’s and e ac h 1’s to
0’s.
Ex: Find one’s complement for the following
1) 1100101

2) 0010001

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 8 Unit-A, Chapter 03, Data Representation

Two’s complement of binary number:


The Two’s complement of binary number is obtained by first find one’s complement and add bit 1
to the least significant bit.
Ex: Find Two’s complement for the following
1) 1101101

2) 1010101

Binary subtraction: The process of finding the difference of two binary numbers is called binary
subtraction.

1) Binary subtraction using 1’s complement


a) Subtraction of smaller number from larger number using 1’s complements (ie, 25-10=+15,
will produce +ve result)
 Make the length of both binary numbers equal.
 Determine the one’s complement of smaller number.
 Add one’s complement to the larger number.
 Add End around carry to the least significant bit (LSB) to obtain a result.

Ex: (32)10 - (24)10

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 9 Unit-A, Chapter 03, Data Representation

Ex: Home W ork (14)10 - (8)10

b) Subtraction of larger number from smaller number using 1’s complement (ie, 10-25= - 15,
will produce –ve result).
 Make the length of both binary numbers equal .
 Determine the one’s complement of larger number.
 Add one’s complement to the smaller number.
 Take a one’s complement of result and put a (-) minus sign to obtain the final answer.

Ex: (24)10 - (32)10

Ex: Home W ork (8)10 - (14)10

2) Binary subtraction using 2’s complement


a) Subtraction of smaller number from larger number using 2’s complement.
 Make the length of both binary numbers equal.
 Determine the two’s complement of smaller number (subtrahend).
 Add the two’s complement to the larger number (Minuend).
 Ignore the carry and remaining bits will give the result of subtraction.

Ex: (32)10 - (24)10

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 10 Unit-A, Chapter 03, Data Representation

Ex: Home W ork (14)10 - (8)10


b) Subtraction of larger number from smaller number using 2’s complement.
 Make the length of both binary numbers equal.
 Determine the two’s complement of larger number (subtrahend).
 Add the two’s complement to the smaller number (minuend).
 There will be no carry, take the two’s complement of result & put a (-) minus sign to
obtain the final answer.

Ex: (24)10 - (32)10

Ex: Home W ork (8)10 - (16)10

Representation of signed number:


Signed number is neither positive nor negative number represented by adding extra bit to the
magnitude of the number.
0 in the signed number represent positive number.
1 in the signed number represents negative number.
Ex:

Computer codes:
The computers are used to process numerical and alphanumerical type of data such as ,
alphabets A to Z, number 0-9 and special symbols +,-,*, /, % etc…
These different types of the data are internally represent, store and transmitted with the he l p of
suitable code called computer codes.

Three types of computer codes


1) Binary Coded Decimal (BCD)
2) Excess-3 BCD code or XS-3 code
3) Extended Binary Coded Decimal Interchange Code (EBCDIC)
4) American Standard Code for Information Interchange (ASCII)

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 11 Unit-A, Chapter 03, Data Representation

1) Binary coded decimal (BCD)


BCD was an early and widely used computer code. It is a 4 bit code to represent a totally
24 =16 characters. 4 bit insufficient to represent all characters. Therefore 6 bit BCD code was
developed by adding two zone bit to represent 2 6 =64 characters, such as 10 decimal
numbers, 26 alphabets and 28 special characters.

Ex: The decimal number 537 is represented in 4-bit BCD code as.

The following table shows the 6-bit BCD code for different characters
CHARACTER BCD CODE CHARACTER BCD CODE
ZONE DIGIT ZONE DIGIT
BIT BIT
A 01 0001 S 11 0001
B - 0010 T - 0010
C - 0011 U -
D - 0100 V -
E - W -
F - X -
G - Y -
H 01 1001 Z 11 1000
I 10 0001 1 00 0001
J - 0010 2 - 0010
K - 3 -
L - 4 -
M - 5 -
N - 6 -
O - 7 -
P - 8 -
Q - 9 -
R 10 1001 0 00 1010

Ex: 6 bit BCD code for word CS.

2) Excess-3 BCD code or XS-3 code


The excess-3 BCD code is a non weighted code and i s obtained from 8421 BCD code by
adding 3 (0011).
Ex: The decimal number 537 would be represented in the XS-3 code as

3) Extended binary coded decimal interchange code (EBCDIC)

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 12 Unit-A, Chapter 03, Data Representation

This code was developed by IBM. It is an 8 bit code to represent a total of 28 =256 charac te rs
by adding 4 zone bit (cursor movement, spacing etc.). It is used in l arge computer such as
mainframe computer.

The following table shows 8bit EBCDIC code for different characters.
CHARACTER EBCDIC CODE CHARACTER EBCDIC CODE
ZONE BIT DIGIT ZONE BIT DIGIT
A 1100 0001 S 1110 0001
B - 0010 T - 0010
C - 0011 U -
D - 0100 V -
E - W -
F - X -
G - Y -
H 1100 1001 Z 1110 1000
I 1101 0001 1 1111 0001
J - 0010 2 - 0010
K - 3 -
L - 4 -
M - 5 -
N - 6 -
O - 7 -
P - 8 -
Q - 9 -
R 1101 1001 0 1111 1010

Ex: 8-bit EBCDIC code for word CS

4) American Standard Code for Information Interchange (ASCII)


Is a 7 bit code for representing a totally 2 7=128 characters by adding 3 zone bit, it is u se d i n
microcomputer & minicomputers.
ASCII code is used to represent two types of characters.
Printable character: The code for alphabets A to Z or a to z, digits 0-9 and special symbols +,
-, *, % ...
Control character: To control the operation of digital c omputer. It provides the code for Ctrl ,
Alt, and Shift key etc.

Ex: 7 bit ASCII code for CS

Following table shows the decimal equivalent of different characters


CHARACTER 7-BIT DECIMAL/ CHARACTER DECIMAL/
ASCII ASCII ASCII
value value

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 13 Unit-A, Chapter 03, Data Representation

A 1000001 65 a 97
B 1000010 66 b 98
C 1000011 67 c 99
D . 68 d 100
E . 69 e 101
F . 70 f 102
G . 71 g 103
H . 72 h 104
I . 73 I 105
J . 74 J 106
K . 75 k 107
L . 76 l 108
M . 77 m 109
N . 78 n 110
O . 79 o 111
P . 80 p 112
Q . 81 q 113
R . 82 r 114
S . 83 s 115
T . 84 t 116
U . 85 u 117
V . 86 v 118
W . 87 w 119
X . 88 x 120
Y . 89 y 121
Z . 90 Z 122
0 0110000 48
1 . 49
2 . 50
3 . 51
4 . 52
5 . 53
6 . 54
7 . 55
8 . 56
9 . 57
Blank 0100000 32
( . 40
+ . 43
$ . 36
* . 42
) . 41
- . 45
/ . 47
, . 44
= . 61
<return> . 13
<linefeed> . 10

NOTE:

Prepared by: VIJA YAKUMAR S, [Link], Lectur er


Page 14 Unit-A, Chapter 03, Data Representation

 ASCII Value for A-Z is 65-90


 ASCII Value for a-z is 97-122
 ASCII Value for 0-9 is 48-57

***********

Prepared by: VIJA YAKUMAR S, [Link], Lectur er

Common questions

Powered by AI

ASCII, being a 7-bit code, allows for the representation of 128 characters, covering a wide array of symbols and control characters, making it versatile for various textual data in computing. It provides more comprehensive character representation compared to BCD, which is limited to 6 bits and designed for only numeral and basic character representation, thus offering improved data compatibility and interoperability across different systems .

The hexadecimal number system is particularly useful in debugging and low-level programming because it can conveniently represent large binary numbers with fewer digits. Each hexadecimal digit represents four binary digits (bits), simplifying binary code representation, and is much more readable to humans compared to long binary strings. This compactness aids in exprEssesing computer memory addresses efficiently and error-checking .

Excess-3 BCD code is derived by adding three to each digit of the standard 8421 BCD code. It is non-weighted and used mainly for error detection in digital systems as the addition of '3' converts the pure binary representations, facilitating easier carry and borrow operations .

Digital systems must efficiently handle both positive and negative numbers to perform comprehensive computations across applications like arithmetic processing, algorithm design, and user interface operations. Binary systems achieve this using signed number representation, commonly with the most significant bit indicating sign (0 for positive, 1 for negative) while the remaining bits store the magnitude. This method ensures consistent data processing and compatibility in algorithm implementations .

The conversion from a decimal fraction to binary involves repeatedly multiplying the decimal fraction by 2 and noting the integer part for each multiplication. This process is continued until the fractional part becomes 0 or reaches a satisfactory precision. The resulting binary fraction is obtained by reading the recorded integer parts from top to bottom, where the first multiplied result gives the most significant digit and the last gives the least significant digit .

Non-positional number systems, such as Roman numerals, represent values using symbols without regard to their position, relying on the accumulation of individual symbol values. Positional number systems, like the decimal or binary systems, use the position of digits to determine their value, with each position representing a power of the base of the system .

The base or radix in a positional number system signifies the number of unique digits, including zero, that a positional numeral system uses to represent numbers. It determines how numbers are weighted based on their position. For instance, base 10 uses powers of 10, affecting how each digit in a number contributes to its overall value and interpretation. This foundational principle facilitates the conversion and computation of numbers across different systems .

Binary subtraction using two's complement involves converting the subtrahend into its two’s complement by inverting its bits and adding 1 to the least significant bit. This two's complement is then added to the minuend. If a carry occurs, it is ignored, and the resulting bits give the subtraction result. This method unifies addition and subtraction into a single process using binary addition, simplifying computation in digital electronics .

To convert a hexadecimal number to its decimal equivalent, identify the position of each digit, multiply each by 16 raised to the power of its position index (counting from right starting at 0), and sum these values. For example, (BAD)16 is calculated by the sum of 11×16^2 + 10×16^1 + 13×16^0, resulting in the decimal equivalent of 2989 .

The binary number system is essential in computing because it corresponds to the digital operation based on two states, typically represented as 0 and 1, which align with on and off states of electronic circuits. This simplicity enabling reliable and efficient processing, storage, and transmission of data is foundational for computer hardware functionality .

You might also like