Page1 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.
Page2 (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 Reading the remainders from bottom to the top, 43 10 = 101011 2 (Compare with result of above method)
Page3 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.375 10 = 0.011 2 (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.375 10 to octal. It will be done in two part :- Firstly Convert 266 8 266 2 8 33 1 8 4 4 0 LSB 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.375 10 = 412.3 8 (v) Octal-to-Decimal Conversion Multiply each octal digit by its position values in terms of 8 raise to the power and add them. For example,
Page4 (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 Equivalent 000 001 010 011 100 101 110 111 For example, Convert 472 8 to binary as follows: 4 7 2 100 111 010 Hence, octal 472 is equivalent to binary 100111010 As another example, 3.16 8 to binary as follows: 3 1 6 010 001 110 3.16 8 = 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 100111010 2 to octal. 1 0 0 1 1 1 0 1 0 4 7 2 Hence, 100111010 2 = 472 8 To illustrate, consider the conversion of 1101.0111 2 to octal. 0 0 1 1 0 1 0 1 1 1 0 0 1 5 3 4 Hence, 1101.0111 2 = 15.34 8 (viii) Decimal-to-Hexadecimal Conversion Using repeated division method by base 16 and multiply fractional part by 16 & store the Integral part, read them from top to bottom. For example, convert 423.03125 10 to hexadecimal number,
Page5 It will be done in two part :- Firstly Convert 423 16 423 7 16 26 A 16 1 1 0 LSB 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.01325 10 = 1A7.08 16 (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.08 16 = 5 x 16 1 + 6 x 16 0 + 0 x 16-1 + 8 x 16-2 = 80 + 6 + 0 + 8/256 = 86+0.03125 = 86.03125 10 (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. 0 0 0 1 0 0 1 1 1 0 1 0 1 3 A Hence, 100111010 2 = 13A 16 To illustrate, consider the conversion of 101101.011101 2 to hexadecimal. 0 0 1 0 1 1 0 1 0 1 1 1 0 1 0 0 2 D 7 4 Hence, 101101.011101 2 = 2D.74 16 (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 digits given below in the table:-
Page6 Hexadecimal Digit Binary Equivalent Hexadecimal Digit Binary Equivalent 0 1 2 3 4 5 6 7 0000 0001 0010 0011 0100 0101 0110 0111 8 9 A 10 B 11 C 12 D 13 E 14 F 15 1000 1001 1010 1011 1100 1101 1110 1111 For example, Convert 8B6 16 to binary as follows: 8 B 6 1000 1011 0110 Hence, hexadecimal 8B6 is equivalent to binary 100010110110 As another example, 3.1C 16 to binary as follows: 3 1 C 0010 0001 1100 3.1C 16 = 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 2 N 1. For example, if in a computer, the word size is 1 byte (8 bits), then An 8 bits word can represent total 2 8 1 = 255 numbers i.e., -127 to 0 and 0 to +128.
Page7 (ii) (iii) 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 2 N 1. For example, Express 13 in One s Complement form in 8-bit. +13 = 0 0 0 0 1 1 0 1 13 = 1 1 1 1 0 0 1 0 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 2 N. For example, Express 17 in Two s Complement form in 8-bit. +13 = 0 0 0 1 0 0 0 1 1 s Complement = 1 1 1 0 1 1 1 0 Add 1 = 1 1 1 0 1 1 1 1 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 2 7 = 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? 1 0 0 1 0 0 0 1 0 0 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 0 0 0 Solution:- Convert each 7-bit code to its Decimal Equivalent. The results are 1 0 0 1 0 0 0 1 0 0 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 0 0 0 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 Scripts also. ISCII has been used by IBM for PC-DOS,
Page8 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.