Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.

Slides:



Advertisements
Similar presentations
Representing Numbers: Integers
Advertisements

Integers. Integer Storage Since Binary consists only of 0s and 1s, we can’t use a negative sign ( - ) for integers. Instead, the Most Significant Bit.
DATA REPRESENTATION Y. Colette Lemard February
COE 202: Digital Logic Design Signed Numbers
©Brooks/Cole, 2003 Chapter 3 Number Representation.
1 IEEE Floating Point Revision Guide for Phase Test Week 5.
Chapter 2 : Number System
Binary Representation Introduction to Computer Science and Programming I Chris Schmidt.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Number Representation Rizwan Rehman, CCS, DU. Convert a number from decimal to binary notation and vice versa. Understand the different representations.
COE 202: Digital Logic Design Number Systems Part 1
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
Binary Number Systems.
Chapter 5 Data representation.
The Binary Number System
Simple Data Type Representation and conversion of numbers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Data Representation – Binary Numbers
Computer Arithmetic Nizamettin AYDIN
Number Systems Part 2 Numerical Overflow Right and Left Shifts Storage Methods Subtraction Ranges.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Chapter 1 Data Storage(3) Yonsei University 1 st Semester, 2015 Sanghyun Park.
Data Representation and Computer Arithmetic
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
The Teacher CP4 Binary and all that… CP4 Revision.
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
BR 8/99 Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to 255.
Number Representation
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
1 Representation of Data within the Computer Oct., 1999(Revised 2001 Oct)
Number Systems and Logic Prepared by Dr P Marais (Modified by D Burford)
Introduction to Number System
AEEE2031 Data Representation and Numbering Systems.
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 2: Number Systems & x86 Instructions Constantine D. Polychronopoulos Professor, ECE Office: 463.
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
07/12/ Data Representation Two’s Complement & Binary Arithmetic.
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
 Lecture 2 Processor Organization  Control needs to have the  Ability to fetch instructions from memory  Logic and means to control instruction sequencing.
SAK Chapter 21 Chapter 2 : Number System 2.1 Decimal, Binary, Octal and Hexadecimal Numbers 2.2 Relation between binary number system with other.
IT1004: Data Representation and Organization Negative number representation.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Representation of Data (Part II) Computer Studies Notes: chapter 19 Ma King Man.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Binary Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
Department of Computer Science Georgia State University
Cosc 2150: Computer Organization
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 6
Data Representation Data Types Complements Fixed Point Representation
Number Representation
Presentation transcript:

Representation of Data Ma King Man

Reference Text Book: Volume 2 Notes: Chapter 19

Road Map Number System Base Conversion between binary, octal and hexadecimal system Base conversion from any base to decimal Base concersion from decimal to any base Fixed - point representation Floating - point number representation Comparison between fixed - point representation and floating point representation

Lets start

Number System Denary base 0,1,2,3,4,5,6,7,8,9 Binary base 0,1 Octal base 0,1,2,3,4,5,6,7 Hexadecimal base 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

Compare… A B C D E F

Base Conversion between binary, octal and hexadecimal system Method 3 binary digits = 1 octal digit 4 binary digits = 1 hexadecimal digit

Example (ii) = (ii) =75 (16)

Example (ii) = (ii) = 165 (8)

Example 3 1A46 (16) = (ii)

Example (8) = (ii)

Base conversion from any base to decimal Method: d n d n-1 d n-2 …… d 1 d 0 d -1 d -2 …… d -m+1 d -m d n b n +d n-1 b n-1 + …… +d 1 b+d 0 +d -1 b -1 + …… +d -m b -m(10)

Examples E.g (ii) =1x x x x x x2 -2 =13.75 E.g (8) =1x x x x x x8 -2 = E.g.311.8(16) =1x x x16 -1 =17.5

Base conversion from decimal to any base ……… ……… ……… ……….1 27 ……….0 23 ……….1 1 Step 1: Convert the integral part: 234 = (ii) Step 2: Convert the fraction part 0.25 = 0.01(ii).25 x x Step 3: Therefore, = (ii)

Lets Try…… E.g = 27.04(8) = 27.04(8)E.g = (ii) = (ii)

Fixed – point representation Usually the point is fixed at the right to the L.S.B. – Least significant bit – i.e. integer. Assume 8 – bit word storage is used (8 – bit per unit) Bit 7 is the sign bit of the number “ 0 ” = positive “ 1 ” = negative

The fixed point representation has the following format: Sign bit

3 methods of fixed-point representation Sign-and-magnitude representation One ’ s complement representation (optional) Two ’ s complement representation

Sign-and-magnitude (i) The leftmost bit indicates the sign. (ii) The remaining bits give the magnitude of the number. E.g (ii) is stored as (+21 in dec.) And (ii) is stored as (-21 in dec.) Range:For 8 – bit word: The smallest number is (-127) The largest number is (+127) Disadvantages: 2 representations for zero: , Requires extra circuit to perform addition and subtraction.

One’s complement representation (i) Add zeros to the left of the binary numbers until the number is fitted the given length. (ii) For a positive integer, the binary pattern is left unchanged. (iii) For a negative integer, 0 is replaced by 1 and 1 by 0. E.g (ii) is stored as And (ii) is stored as Range:For 8 – bit word: The smallest number is (- 127) The largest number is (+127) Disadvantages: Same as sign-and-magnitude representation Zero: ,

Two’s complement representation (Most commonly used) (i) and (ii) are same as 1 ’ s complement method. For a negative integer, add 1 to the rightmost bit of it ’ s 1 ’ s complement. E.g (ii) is stored as And – 10101(ii) is stored as Range: For 8 – bit word: The smallest number is (-128) The largest number is (+127) Advantages: It has wider range than both sign-and-magnitude and 1 ’ s complement, and no ambiguity for zero. Subtraction can be done by addition, no extra circuit is required.

Example 1 Assume 8 – bit word and 2 ’ s complement notation is used. E.g = (binary no.) = (internal representation) = (internal representation) = (binary no.) =

Example 2 E.g.23 – 17 =10111 – 10001(binary no.) = (-10001)(internal representation) = (internal representation) = (internal representation) =110 (ii) (binary no.) =

Example 3 E.g. 17 – 23 =10001 – = (-10111) = = =-110 (ii) =

Special cases (-21) (-75) (-96) (-117) (-83) (+56) (+117) (+44) (-95) Carry discard Overflow Error