CSE20 Lecture 4 - CSE 20 Lecture 4 CK Cheng UC San Diego Negative numbers Ones and Twos Complement Residual numbers 1 Announcements CK No office

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

View Full Document Right Arrow Icon
1 CSE 20 Lecture 4 01/14/10 c Negative numbers One’s and Two’s Complement c Residual numbers CK Cheng, UC San Diego
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 • CK No office hours next week • Pat No office hours next week • On Tuesday 1/19, Peng Du will be going over Chapter 11(Shaum’s) • On Thursday 1/21, Peng Du will be going over Chapter 11 (Shaum’s) • Midterm will be held on 1/28 Announcements
Background image of page 2
3 One’s Complement Given two positive integers x & y, perform: x + y x – y – x + y – x – y
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 How to Solve 1) Derive 1’s complement of the operands 2) Sum up the two operands 3) Use carry-out to feed into carry-in 4) The result is the solution in 1’s complement Carry-In Carry-Out
Background image of page 4
5 Formulas for 1’s Complement Arithmetic 1’s Complement x+y x+y x-y x+(2 n -1-y)=2 n -1+(x-y) -x+y (2 n -1-x)+y = 2 n- 1+(-x+y) -x-y (2 n -1-x)+(2 n -1-y)=2 n -1+(2 n -1-x-y)
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 1’s Complement Example: 4 – 3 = 1 3 in binary = 0011. Flipping the bits, you get –3 (1100) in binary, which is 12. 0100
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/12/2011 for the course CS 1 taught by Professor Staff during the Fall '08 term at Cornell University (Engineering School).

Page1 / 12

CSE20 Lecture 4 - CSE 20 Lecture 4 CK Cheng UC San Diego Negative numbers Ones and Twos Complement Residual numbers 1 Announcements CK No office

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