??? 06/09/04 13:34 Read: times |
#72180 - RE: 8051 class - Signed Numbers Responding to: ???'s previous message |
Gary Burt said:
If any one wants to see the web pages for the course, check it out at:
http://www.csee.umbc.edu/courses/u...er04/burt/ Any comments appreciated, since you are source of good information. Well, I looked at the page on negative numbers, and I'm afraid I'd find it more confusing than helpful if I were a student again: "We have looked at unsigned numbers so far. In the computer, unsigned numbers start at zero and go to 2n-1. So, 216 goes from 0 to 65535." Whoa there! You've just suddenly thrown in this 'n' from nowhere - what does it mean? "216 goes from 0 to 65535." No, it doesn't. 216 is exactly equal to 65536 - for all values of 2 and 16! "To do that, we reserved the left-most bit to represent the sign of the number. Zero is a positive number and one is a negative number." You could be clearer there; my first reaction was, No! one is not a negative number! - then I read it again (a couple of times) and realised that you mean "A zero in the sign bit indicates a positive number, and a one in the sign bit indicates a negative number." "Example: 1011 decimal value is 11 0100 1's complement 0101 1's complement with 1 added = 2's complement = -11"But you just said that a zero (in the left-most bit) indicates a positive number - so how can 01012 be negative?! I think what you mean is:: 01011 decimal value is +11 (sign bit is zero) 10100 1's complement 10101 1's complement with 1 added = 2's complement = -11"and then the example addition becomes: 01011 decimal value +11 10101+ decimal value -11 ------- 1 00000 |