2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.

Slides:



Advertisements
Similar presentations
Lecture - 2 Number systems and computer data formats
Advertisements

2-1 Chapter 2 - Data Representation Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Chapter 2: Data Representation
Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
Floating Point Numbers. CMPE12cGabriel Hugh Elkaim 2 Floating Point Numbers Registers for real numbers usually contain 32 or 64 bits, allowing 2 32 or.
Assembly Language and Computer Architecture Using C++ and Java
Signed Numbers.
Assembly Language and Computer Architecture Using C++ and Java
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
Floating Point Numbers
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
Floating Point Numbers
Computer Science 210 Computer Organization Floating Point Representation.
Lecture 8 Floating point format
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
Binary Number Systems.
School of Computer Science G51CSA 1 Computer Arithmetic.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
1.6 Signed Binary Numbers.
Binary Representation and Computer Arithmetic
Chapter 5 Data representation.
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
The Binary Number System
Simple Data Type Representation and conversion of numbers
Data Representation – Binary Numbers
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Information Representation (Level ISA3) Floating point numbers.
3-1 Chapter 3 - Arithmetic Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer Architecture.
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
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.
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
Computer Architecture
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer.
Binary Arithmetic & Data representation
Lecture Overview Introduction Positional Numbering System
Data Representation and Computer Arithmetic
COMPSCI 210 Semester Tutorial 1
Data Representation - Part II. Characters A variable may not be a non-numerical type Character is the most common non- numerical type in a programming.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Data Representation in Computer Systems
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
CSC 221 Computer Organization and Assembly Language
AEEE2031 Data Representation and Numbering Systems.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
Floating Point Numbers
Numbers in Computers.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Computer Organization 1 Data Representation Negative Integers.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Department of Computer Science Georgia State University
Computer Science 210 Computer Organization
Introduction To Computer Science
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 6
Data Representation Data Types Complements Fixed Point Representation
Computer Science 210 Computer Organization
COMS 161 Introduction to Computing
Chapter3 Fixed Point Representation
Presentation transcript:

2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents 2.1 Introduction 2.2 Fixed Point Numbers 2.3 Floating Point Numbers 2.5 Character Codes

2-2 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring 3-Bit Signed Integer Representations

2-3 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Excess (Biased) The leftmost bit is the sign (usually 1 = positive, 0 = negative). Positive and negative representations of a number are obtained by adding a bias to the two’s complement representation. This goes both ways, converting between positive and negative numbers. The effect is that numerically smaller numbers have smaller bit patterns, simplifying comparisons for floating point exponents. Example (excess 128 “adds” 128 to the two’s complement version, ignoring any carry out of the most significant bit) : = = One representation for zero: +0 = , -0 = Largest number is , smallest number is , using an 8-bit representation.

2-4 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring BCD Representations in Nine’s and Ten’s Complement Each binary coded decimal digit is composed of 4 bits. Example: Represent in BCD: This is obtained by first subtracting each digit of 079 from 9 to obtain the nine’s complement, so = 920. Adding 1 produces the ten’s complement: = 921. Converting each base 10 digit of 921 to BCD produces

2-5 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Binary Addition This simple binary addition example provides background for the signed number representations to follow.

2-6 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Normalization The base 10 number 254 can be represented in floating point form as 254  10 0, or equivalently as: 25.4  10 1, or 2.54  10 2, or.254  10 3, or.0254  10 4, or infinitely many other ways, which creates problems when making comparisons, with so many representations of the same number. Floating point numbers are usually normalized, in which the radix point is located in only one possible position for a given number. Usually, but not always, the normalized representation places the radix point immediately to the left of the leftmost, nonzero digit in the fraction, as in:.254  10 3.

2-7 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Conversion Example Example: Convert (9.375  ) 10 to base 2 scientific notation Start by converting from base 10 floating point to base 10 fixed point by moving the decimal point two positions to the left, which corresponds to the -2 exponent: Next, convert from base 10 fixed point to base 2 fixed point:  2=  2=  2=  2=1.5.5  2=1.0 Thus, (.09375) 10 = (.00011) 2. Finally, convert to normalized base 2 floating point: =  2 0 = 1.1  2 -4

2-8 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring IEEE-754 Floating Point Formats

2-9 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring IEEE-754 Examples

2-10 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring IEEE-754 Conversion Example Represent in single precision IEEE-754 format. Step #1: Convert to target base = Step #2: Normalize =  2 3 Step #3: Fill in bit fields. Sign is negative, so sign bit is 1. Exponent is in excess 127 (not excess 128!), so exponent is represented as the unsigned integer = 130. Leading 1 of significand is hidden, so final bit pattern is:

2-11 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Effect of Loss of Precision According to the General Accounting Office of the U.S. Government, a loss of precision in converting 24- bit integers into 24-bit floating point numbers was responsible for the failure of a Patriot anti- missile battery.

2-12 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring ASCII Character Code ASCII is a 7-bit code, commonly stored in 8-bit bytes. “A” is at To convert upper case letters to lower case letters, add Thus “a” is at = The character “5” at position is different than the number 5. To convert character-numbers into number- numbers, subtract : = 5.

2-13 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring

2-14 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Unicode Character Code Unicode is a 16- bit code.