CSC 220: Computer Organization Signed Number Representation

Slides:



Advertisements
Similar presentations
Addition and Subtraction. Outline Arithmetic Operations (Section 1.2) – Addition – Subtraction – Multiplication Complements (Section 1.5) – 1’s complement.
Advertisements

Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Lecture 12: Computer Arithmetic Today’s topic –Numerical representations –Addition / Subtraction –Multiplication / Division 1.
Binary Representation - Shortcuts n Negation x + x = 1111…1111 two = -1 (in 2’s complement) Therefore, -x = x + 1 n Sign Extension o Positive numbers :
Computer Systems 1 Fundamentals of Computing Negative Binary.
Binary numbers and arithmetic. ADDITION Addition (decimal)
Chapter 5 Data representation.
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
© Janice Regan, CMPT 128, Jan CMPT 128: Introduction to Computing Science for Engineering Students Integer Data representation Addition and Multiplication.
Data Representation – Binary Numbers
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
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.
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
CPS3340 Computer Architecture Fall Semester, 2013
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Slide 1 of 14.
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Fri, Aug 28 CEC 220 Digital Circuit Design Slide 1 of 14.
IT1004: Data Representation and Organization Negative number representation.
Negative Integers Unsigned binary representation can not be used to represent negative numbers. With paper and pencil arithmetic, a number is made negative.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative The same is true for binary numbers a computer.
Computer Organization 1 Data Representation Negative Integers.
973cs111_add_posneg.ppt Integers Whole numbers Do NOT contain decimal points (as in money) 43,689 is an integer 43, is NOT an integer (it is floating.
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
Unit I From Fundamentals of Logic Design by Roth and Kinney.
Representing Positive and Negative Numbers
Negative Number Sign-Magnitude: left-most bit as the sign bit –16 bits –Example: 4-bit numbers is given by is given by ’s complement:
Floating Point Numbers Dr. Mohsen NASRI College of Computer and Information Sciences, Majmaah University, Al Majmaah
Computer Representation of Information
Department of Computer Science Georgia State University
DAT10403 CHAPTER 4 COMPUTER ARITHMETIC By Noordiana Kassim
Computer Architecture & Operations I
Negative Integers Unsigned binary representation can not be used to represent negative numbers. With paper and pencil arithmetic, a number is made negative.
CHAPTER 9 COMPUTER ARITHMETIC - ALU
Negative Binary Numbers
Integer Real Numbers Character Boolean Memory Address CPU Data Types
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Computer Science 210 Computer Organization
CSCI206 - Computer Organization & Programming
Section 2: Integer & Floating Point Numbers
Computer Architecture & Operations I
Negative Binary Numbers
CSE 102 Introduction to Computer Engineering
CHAPTER 4: Representing Integer Data
Exercise: Add these two single precision IEEE 754 numbers: … …0 Left number: 1.101x24 Right number: 1.011x 22= x24.
Addition and Substraction
Dr. Clincy Professor of CS
Binary Addition & Subtraction
Chapter 5 Data representation.
Data Structures Mohammed Thajeel To the second year students
Computer Organization and ASSEMBLY LANGUAGE
Computer Science 210 Computer Organization
CSCI206 - Computer Organization & Programming
Data Representation in Computer Systems
Unit 18: Computational Thinking
Negatives, Addition, Subtraction
CS 101 – Sept. 4 Number representation Integer Unsigned √ Signed √
C1 Number systems.
CPS120: Introduction to Computer Science
Decimal and binary representation systems
Number Systems Rayat Shikshan Sanstha’s
Numbers representations
Number Systems Rayat Shikshan Sanstha’s
Negative Bit Representation Outline
GCSE COMPUTER SCIENCE Topic 3 - Data 3.2 Signed Integers.
GCSE COMPUTER SCIENCE Topic 3 - Data 3.3 Logical and Arithmetic Shifts.
Two’s Complement & Binary Arithmetic
Presentation transcript:

CSC 220: Computer Organization Signed Number Representation College of Computer and Information Sciences Department of Computer Science CSC 220: Computer Organization Unit 4 Signed Number Representation For Review

Overview Unsigned Representation Representation of signed numbers Unit 4: Signed Number Representation Overview Unsigned Representation Representation of signed numbers Signed Magnitude Representation One’s Complement Notation Two’s Complement Notation Two’s Complement Addition Comparing Signed Number Systems Signed Overflow

For Review

Unsigned Representation Represents positive integers. Ex: 8 bit representation of unsigned numbers: Addition is simple: 0 0 0 0 1 0 0 1 + 0 0 0 0 0 1 0 1 = 0 0 0 0 1 1 1 0. position 7 6 5 4 3 2 1 contribution 27 26 25 24 23 22 21 20 157 10

Binary Addition (1 of 2) Two 1-bit values A B A + B 1 10 “two”

Binary Addition (2 of 2) Two n-bit values Add individual bits Propagate carries E.g., 1 1 00010101 21 +00011001 + 25 00101110 46

Advantages and disadvantages of unsigned notation One representation of zero Simple addition Disadvantages Negative numbers can not be represented. The need of different notation to represent negative numbers.

Representation of signed numbers Is a representation of negative numbers possible? Unfortunately: you can not just stick a negative sign in front of a binary number. (it does not work like that) There are three methods used to represent negative numbers. Signed magnitude notation One’s complement notation Two’s complement notation

For Review

Example Suppose 10011101 is a signed magnitude representation of a 8 bit number. The sign bit is 1, then the number represented is negative The magnitude is 0011101 with a value 24+23+22+20= 29 Then the number represented by 10011101 is –29. position 7 6 5 4 3 2 1 contribution - 24 23 22 20 -29

Exercise 1 3710 has 0010 0101 in signed magnitude notation. Find the signed magnitude of –3710 in 8 bits? Using the signed magnitude notation find the 8-bit binary representation of the decimal value 2410 and -2410. Find the signed magnitude of –63 using 8-bit binary sequence?

Disadvantage of Signed Magnitude Addition and subtractions are difficult: Signs and magnitude, both have to carry out the required operation. They are two representations of 0 00000000 = + 010 10000000 = - 010 To test if a number is 0 or not, the CPU will need to see whether it is 00000000 or 10000000. 0 is always performed in programs. Therefore, having two representations of 0 is inconvenient.

For Review

Two’s Complement Notation The most used representation for integers. All positive numbers begin with 0. All negative numbers begin with 1. One representation of zero Ex: 0 is represented as 0000 using 4-bit binary sequence.

Example: 11110101 in Two’s Complement (8 bit number) The most significant bit is 1, hence it is a negative number. Corresponding number is 00001011 = 8 + 2+1 = 11 the result is then –11.

Advantages of Two’s Complement Notation It is easy to add two numbers. Subtraction can be easily performed. Multiplication is just a repeated addition. Division is just a repeated subtraction Two’s complement is widely used in ALU

For Review

For Review

For Review

For Review