This preview shows pages 1–7. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CSE20 Lecture 3 Number Systems: Negative Numbers 1. Sign and Magnitude Representation 2. 1s Complement Representation 3. 2s Complement Representation 1 CK Cheng, UC San Diego 2 Outlines 1.Goal of the Negative Number Systems 2.Definition 1.Sign Magnitude Rep. 2.1s Complement Rep. 3.2.s Complement Rep. 3.Arithmetic Operations Goal of negative number systems Signed system: Simple. Just flip the sign bit 0 = positive 1 = negative Ones complement: Replace subtraction with addition Easy to derive (Just flip every bit) Twos complement: Replace subtraction with addition Addition of ones complement and one produces the twos complement. 3 Definitions: Given a positive integer x, we represent x 1s complement: Formula: 2 n 1 x i.e. n=4, 2 4 1 x = 15 x In binary: (1 1 1 1) (b 3 b 2 b 1 b ) Just flip all the bits. 2s complement: Formula: 2 n x i.e. n=4, 2 4 x = 16 x In binary: ( 1 0 0 0 0) ( b 3 b 2 b 1 b ) Just flip all the bits and add 1. 4 5 Definitions: 4Bit Example Definitions: Examples Given nbits, what is the range of my numbers in each system?...
View Full
Document
 Fall '08
 Foster

Click to edit the document details