lec3 - CSE20 Lecture 3 Number Systems: Negative Numbers 1....

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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: 4-Bit Example Definitions: Examples Given n-bits, what is the range of my numbers in each system?...
View Full Document

Page1 / 17

lec3 - CSE20 Lecture 3 Number Systems: Negative Numbers 1....

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online