This preview shows pages 1–7. Sign up to view the full content.
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
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document 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
3
One’s Complement
•
Given two positive integers x & y,
perform:
x + y
x – y
– x + y
– x – y
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document 4
How to Solve
1) Derive 1’s complement of the operands
2) Sum up the two operands
3) Use carryout to feed into carryin
4) The result is the solution in 1’s
complement
CarryIn
CarryOut
5
Formulas for 1’s Complement
Arithmetic
1’s Complement
x+y
x+y
xy
x+(2
n
1y)=2
n
1+(xy)
x+y
(2
n
1x)+y = 2
n
1+(x+y)
xy
(2
n
1x)+(2
n
1y)=2
n
1+(2
n
1xy)
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document 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
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).
 Fall '08
 STAFF

Click to edit the document details