Negative binary numbers 1 Computer Architectures M.

Slides:



Advertisements
Similar presentations
2’s Complement Arithmetic (remember it’s a fixed length system)
Advertisements

James Tam Numerical Representations On The Computer: Negative And Rational Numbers How are negative and rational numbers represented on the computer? How.
King Fahd University of Petroleum and Minerals
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Signed Numbers.
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
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.
Computer ArchitectureFall 2007 © August 29, 2007 Karem Sakallah CS 447 – Computer Architecture.
Number Systems Lecture 02.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
NEGATIVE BINARY NUMBER – Digital Circuit 1 Choopan Rattanapoka.
Converting binary to decimal decimal to binary
Lecture 12: Computer Arithmetic Today’s topic –Numerical representations –Addition / Subtraction –Multiplication / Division 1.
Simple Data Type Representation and conversion of numbers
Data Representation – Binary Numbers
Conversion Between Lengths Positive number pack with leading zeros +18 = = Negative numbers pack with leading ones -18 =
Chapter 7 Arithmetic Operations and Circuits Binary Arithmetic Addition –When the sum exceeds 1, carry a 1 over to the next-more-significant column.
Computer Architecture
Binary Arithmetic & Data representation
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
CPS120: Introduction to Computer Science Computer Math: Signed Numbers.
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.
1 Digital Design: Number Systems Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals of Logic.
ECEG-3202: Computer Architecture and Organization, Dept of ECE, AAU 1 Floating-Point Arithmetic Operations.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Chapter 3 Complements Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
Tutorial: ITI1100 Dewan Tanvir Ahmed SITE, UofO
Data Representation in Computer Systems. 2 Signed Integer Representation The conversions we have so far presented have involved only positive numbers.
Number Systems & Operations
07/12/ Data Representation Two’s Complement & Binary Arithmetic.
Ch3a- 2 EE/CS/CPE Computer Organization  Seattle Pacific University Crunching Numbers Topics we need to explore Representing numbers on a computer.
WEEK #2 NUMBER SYSTEMS, OPERATION & CODES (PART 1)
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Slide 1 of 14.
Introduction * Binary numbers are represented with a separate sign bit along with the magnitude. * For example, in an 8-bit binary number, the MSB is.
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Fri, Aug 28 CEC 220 Digital Circuit Design Slide 1 of 14.
Arithmetic Operations
DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck.
IT1004: Data Representation and Organization Negative number representation.
© Prepared By: Razif Razali 1 CHAPTER TWO TCS1023 NUMBERING SYSTEM.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.
1 CS 151 : Digital Design Chapter 4: Arithmetic Functions and Circuits 4-3 : Binary Subtraction.
Chapter 8 Computer Arithmetic. 8.1 Unsigned Notation Non-negative notation  It treats every number as either zero or a positive value  Range: 0 to 2.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Computer Organization 1 Data Representation Negative Integers.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
Advanced Binary b. describe and use two’s complement and sign and magnitude to represent negative integers; c. perform integer binary arithmetic, that.
Addition and Subtraction
Lecture 2 Topics Binary Arithmetic (Unsigned binary operands)
Integer Representations and Arithmetic
Dr. Clincy Professor of CS
Dr. Clincy Professor of CS
Lecture 2 Topics Binary Arithmetic (Unsigned binary operands)
Data Representation in Computer Systems
Dr. Clincy Professor of CS
CPS120: Introduction to Computer Science
Chapter 6: Computer Arithmetic
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic
ECE 331 – Digital System Design
Presentation transcript:

Negative binary numbers 1 Computer Architectures M

2 Negative binary numbers Many different coding systems: 2’ complement is almost always used Given a binary positive number its 2’s complement (negative equivalent) can be obtained by substituting the 1s with 0s and viceversa (bit complement operation) and summing then 1. Same procedure for converting 2’s complement negative numbers into positive numbers The 2’s complement negative numbers have a “1” as most significant bit in a relative numbers context and those positive (including the zero which is a “particolar” number – is a «not» number) have a “0” as most significant bit. The elementary operations with 2’s complement numbers produce 2’s complement numbers (very simple for sums and subtractions, more complex for moltiplications and divisions – Booth algorithm) => = => => = => +37

Negative binary numbers 3 In case of a carry beyond the MSB the carry must be discarded (automatically implemented in the computers for physical reasons ) = 18= 1101= -3= => = = -46 = ERROR – OVERFLOW -83 |-83| > 63 By summing two negative numbers we have obtained a positive number !!! “Overflow” error in the computers The 2’s complement provide correct results within the definition range (in our case with 7 bit – 6 bit plus sign – the numbers from that is up to that is ). In general with n bit the range is -2 n-1 to +2 n-1 -1 (because of the zero..). Example 4 bit (3 bit + sign ) range from > -8 to > +7 Careful !!

4 The zero remains unchanged (0000 => => 0000 discarding the last bit) Non integer number arithmetic is extremely complex (floating point numers) With N bit numbers (that is N-1 data bit plus sign) the numbers range is 2 N N Ex. With 8 bit (7 + 1 bit) -> 2 N-1 = 2 7 = > -2 N-1 = -128 and 2 N-1 -1 = 127 Negative binary numbers