COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.6 Instructor: Lin Chen Sept 2013.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Chapter 1.7 Storing Fractions. Excess Notation, continued… In this notation, "m" indicates the total number of bits. For us (working with 8 bits), it.
Arithmetic & Logic Unit Does the calculations Everything else in the computer is there to service this unit Handles integers May handle floating point.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Chapter 5 Floating Point Numbers. Real Numbers l Floating point representation is used whenever the number to be represented is outside the range of integer.
CSCI 3 CH 1.6. REMINDER Remember to put your Student ID # on your homework Remember to put your Student ID # on your homework If you are not going to.
Assignment 4 Sample problems. Convert the following decimal numbers to binary
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Signed Numbers CS208. Signed Numbers Until now we've been concentrating on unsigned numbers. In real life we also need to be able represent signed numbers.
Number System and Codes
Lecture 8 Floating point format
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
3. Representing Integer Data
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
The Binary Number System
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
Simple Data Type Representation and conversion of numbers
Lecture 5.
Copyright © Cengage Learning. All rights reserved. CHAPTER 2 THE LOGIC OF COMPOUND STATEMENTS THE LOGIC OF COMPOUND STATEMENTS.
CS105 INTRODUCTION TO COMPUTER CONCEPTS BINARY VALUES & NUMBER SYSTEMS Instructor: Cuong (Charlie) Pham.
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Number Systems Part 2 Numerical Overflow Right and Left Shifts Storage Methods Subtraction Ranges.
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Computer Science 111 Fundamentals of Programming I Number Systems.
Chapter 1 Data Storage(3) Yonsei University 1 st Semester, 2015 Sanghyun Park.
Computer Architecture
Binary Arithmetic & Data representation
9.4 FLOATING-POINT REPRESENTATION
Calculating Two’s Complement. The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
The Teacher CP4 Binary and all that… CP4 Revision.
6 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Chapter 2: The Logic of Compound Statements 2.5 Application: Number Systems and Circuits for Addition 1 Counting in binary is just like counting in decimal.
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.
The Teacher CP4 Binary and all that… CP4 Revision.
Number Systems Revision of conversations What is a register Addition Complementation.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 2.1 Instructor: Lin Chen Sept 2013.
CS 101 – Aug. 31 Interpreting binary  decimal √ Decimal  binary Shorthand ways of expressing binary –Octal –“Hex” Negative numbers.
By Jariya Phongsai A two's-complement system is a system in which negative numbers are represented by the two's complement of the absolute value; this.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 2.2 Instructor: Lin Chen Sept 2013.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Digital Representations ME 4611 Binary Representation Only two states (0 and 1) Easy to implement electronically %0= (0) 10 %1= (1) 10 %10= (2) 10 %11=
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI N305 Information Representation: Negative Integer Representation.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.5 Instructor: Lin Chen Sept 2013.
Lecture 6 Excess Notation. Excess 8 notation indicates that the value for zero is the bit pattern for 8, that is 1000 Excess 8 notation indicates that.
IT1004: Data Representation and Organization Negative number representation.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.7 Instructor: Lin Chen Sept 2013.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Computer Organization 1 Data Representation Negative Integers.
Lecture 2: 8/29/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Software Design and Development Storing Data Computing Science.
1 Integer Representations V1.0 (22/10/2005). 2 Integer Representations  Unsigned integer  Signed integer  Sign and magnitude  Complements  One’s.
Binary Arithmetic James A. Rome Tennessee Governor's Academy August 2010.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
Representing Positive and Negative Numbers
Department of Computer Science Georgia State University
Fundamentals of Computer Science
Introduction To Computer Science
Computer Science 210 Computer Organization
Computer Science 210 Computer Organization
1.6) Storing Integer:.
1.6) Storing Integer: 1.7) storing fraction:
Presentation transcript:

COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.6 Instructor: Lin Chen Sept 2013

1.6 Storing Integers 1 Data Storage Two’s Complement Excess Notation Pearson Custom: Computer Science, Data Representation and Machine Concepts ii-iii-iv-fall-2005-spring-2006/comps-programming/number_systems.pdf

Two’s Complement 1.6 Storing Integers Use a fixed number of bits to represent each of the values in the system First bit is used to represent the sign, 1 represents negative number, 0 represent nonnegative number A negative number is represented by inverting the bits of its corresponding positive number in each place, then add 1 to the inverted number Suppose to use 4 bits to represent the number = =

Two’s Complement 1.6 Storing Integers Write the two’s complement notation for -6, -3, -1.

Two’s Complement 1.6 Storing Integers Bit Pattern Value Represented Four Bits

Two’s Complement 1.6 Storing Integers Addition 7 – 2 = 7 + (-2) = ?

Two’s Complement 1.6 Storing Integers Addition 7 – 2 = 7 + (-2) = ? Use four bits = 5 10

Two’s Complement 1.6 Storing Integers Use two’s complement notation to calculate: 7 – 5 = ? -3 – 4 = ? 6 – 4 = ? -2 – 5 = ?

Two’s Complement 1.6 Storing Integers What is the range of numbers that can be represented using the 2’s complement? Answer: 2 N-1 – 1 to -2 N-1 Three bits: 3 to -4 Four bits: 7 to -8 Eight bits: ? N is the number of bits

Two’s Complement 1.6 Storing Integers List all the number with the two’s complement notation using 3 bits Express with the two’s complement notation using 8 bits

Two’s Complement 1.6 Storing Integers Overflow Calculate with two’s complement notation using 4 bits

Excess Notation 1.6 Storing Integers Steps: 1.Add the excess value 2 N-1 to the number, where N is the number of bits used 2.Convert the resulting number into binary format Suppose use 4 bits = 20010

Two’s Complement 1.6 Storing Integers Write -8 to 7 with excess notation with 4 bits Write -4 to 3 with excess notation with 3 bits