Chapter 3 DATA REPRESENTATION

Similar documents
DATA REPRESENTATION. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift, Jaipur Region. Based on CBSE curriculum Class 11. Neha Tyagi, KV 5 Jaipur II Shift

Binary Codes. Dr. Mudathir A. Fagiri

Digital Fundamentals

Number System. Introduction. Decimal Numbers

COE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design

Chapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.

Chapter 11 : Computer Science. Information Representation. Class XI ( As per CBSE Board) New Syllabus

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

Octal & Hexadecimal Number Systems. Digital Electronics

Number representations

Number Systems. TA: Mamun. References: Lecture notes of Introduction to Information Technologies (ITEC 1011) by Dr Scott MacKenzie

BINARY SYSTEM. Binary system is used in digital systems because it is:

MACHINE LEVEL REPRESENTATION OF DATA

Introduction to Numbering Systems

UNIT 7A Data Representation: Numbers and Text. Digital Data

CHW 261: Logic Design

umber Systems bit nibble byte word binary decimal

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

Review of Number Systems

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

TOPICS. Other Number Systems. Other Number Systems 9/9/2017. Octal Hexadecimal Number conversion

Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

CMPS 10 Introduction to Computer Science Lecture Notes

UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES

Chapter 2 Number Systems and Codes Dr. Xu

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

Fundamentals of Programming (C)

Numeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:

Electronic Data and Instructions

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Digital Logic Lecture 2 Number Systems

M1 Computers and Data

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

D I G I T A L C I R C U I T S E E

Introduction to Computers and Programming. Numeric Values

DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM

CHAPTER 2 Data Representation in Computer Systems

Binary Systems and Codes

CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 (b) : AND CODES

Objectives. Connecting with Computer Science 2

LOGIC DESIGN. Dr. Mahmoud Abo_elfetouh

Beyond Base 10: Non-decimal Based Number Systems

Numbers!!...is that right? CSCI 255

CS & IT Conversions. Magnitude 10,000 1,

Module -10. Encoder. Table of Contents

Number Systems Base r

MONTHLY TEST MAY 2017 QUESTION BANK FOR AVERAGE STUDENTS. Q.2 What is free software? How is it different from Open Source Software?

Number Systems CHAPTER Positional Number Systems

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Lecture 1: Digital Systems and Number Systems

Lecture 2: Number Systems

NUMBER SYSTEMS AND CODES

Memory Addressing, Binary, and Hexadecimal Review

COMP Overview of Tutorial #2

CHAPTER 2 - DIGITAL DATA REPRESENTATION AND NUMBERING SYSTEMS

Numbering systems. Dr Abu Arqoub


Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Number Systems. Dr. Tarek A. Tutunji Philadelphia University, Jordan

Chapter 1 Review of Number Systems

Conversion Between Number Bases

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

The Gray Code. Script

Beyond Base 10: Non-decimal Based Number Systems

Positional Number System

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee

Outline. What Digit? => Number System. Decimal (base 10) Significant Digits. Lect 03 Number System, Gates, Boolean Algebra. CS221: Digital Design

Ms Sandhya Rani Dash UNIT 2: NUMBER SYSTEM AND CODES. 1.1 Introduction

Analogue vs. Discrete data

Experimental Methods I

Bits. Binary Digits. 0 or 1

Data Representation and Binary Arithmetic. Lecture 2

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

Lecture (01) Introduction Number Systems and Conversion (1)

Korea University of Technology and Education

World Inside a Computer is Binary

Chapter 2. Data Representation in Computer Systems

Logic and Computer Design Fundamentals. Chapter 1 Digital Computers and Information

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

1.1. Unit 1. Integer Representation

Digital Logic Lecture 4 Binary Codes

Binary. Hexadecimal BINARY CODED DECIMAL

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Digital Fundamentals

Using sticks to count was a great idea for its time. And using symbols instead of real sticks was much better.

Microcomputers. Outline. Number Systems and Digital Logic Review

CMPE223/CMSE222 Digital Logic Design. Positional representation

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

ITEC 1011 Introduction to Information Technologies

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Chapter 2 Data Representations

1.3 Systems of numeration: To represent quantities in the different systems of numeration, specific symbols are used, which are also called ciphers.

Digital codes. Resources and methods for learning about these subjects (list a few here, in preparation for your research):

Number System (Different Ways To Say How Many) Fall 2016

T02 Tutorial Slides for Week 2

CS 121 Digital Logic Design. Chapter 1. Teacher Assistant. Hadeel Al-Ateeq

TOPIC: NUMBER SYSTEMS

Transcription:

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.