CS 120 Lecture Notes - Lecture 3: Negative Number, Signed Number Representations

43 views2 pages

Document Summary

Signed magnitude: reserving the first bit to represent positivity or negativity. Representing 5 in signed binary, the positive number would be 0101, and the negative number 5 would be 1101. One"s compliment: switching all the numbers to the other number to represent negativity. Given that 5 is 0101 in unsigned binary, -5 is 1010 in one"s compliment signed binary. This leads to the problem of -0: 0101 + 1010 = 1111, 5 + (-5) = 0, but the equation in one"s compliment signed binary gives the number. Two"s compliment: this has a similar process to one"s compliment, but after flipping the bits, add 1 to the number. This gets rid of the -0 problem. This also has signed magnitude, because the first number represents if the number is positive: 1 is negative, so the number needs to be converted back to its positive version to obtain the number.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents