evan Posted January 11, 2004 Share Posted January 11, 2004 hi, i'm new here, hope this post is in the right place. Anyway, just wanna ask a silly question: what are the results of the two operationz on UNSIGNED numbers, noting nay overflow conditions? 1) 1010 + 1100 2) 1010 - 1100 Plz give some explanations, cheers. Link to comment Share on other sites More sharing options...
.Atlantis Posted January 11, 2004 Share Posted January 11, 2004 1) 1110 2) 90 Don't take that seriously Link to comment Share on other sites More sharing options...
Nollog Posted January 11, 2004 Share Posted January 11, 2004 I haven't toched this in a year and I forget things but... 1010 +1100 =[1]0110 A flag would be set for overflow. 1010 - 1100 I can't remember subtraction... Link to comment Share on other sites More sharing options...
evan Posted January 11, 2004 Author Share Posted January 11, 2004 I haven't toched this in a year and I forget things but... 1010 +1100 =[1]0110 A flag would be set for overflow. 1010 - 1100 I can't remember subtraction... addition should be easy when u indicate the overflow, don't know the solution to subtraction. thx anyway. Link to comment Share on other sites More sharing options...
Nollog Posted January 11, 2004 Share Posted January 11, 2004 1010 - 1100 =1110 I think... Why not use calculator if you have windows? Link to comment Share on other sites More sharing options...
Dudda Posted January 11, 2004 Share Posted January 11, 2004 1010- 1100 =1110 I think... Why not use calculator if you have windows? surely that will give you a negative number Link to comment Share on other sites More sharing options...
Nollog Posted January 11, 2004 Share Posted January 11, 2004 maybe 0110 then... Link to comment Share on other sites More sharing options...
markwolfe Veteran Posted January 11, 2004 Veteran Share Posted January 11, 2004 Binary subtraction is just like decimal subtraction.... but different... :rofl: 01 -01 === 00 10 -01 === 01 When you subtract binary, and you have a 1-0 situation, subtract 1 from the binary digit to the left, and make the 0 a 2. [btw, in your example 2, since you are subtracting a larger number from a smaller one (and the numbers are unsigned), then you get an underflow condition] Link to comment Share on other sites More sharing options...
evan Posted January 11, 2004 Author Share Posted January 11, 2004 1010 - 1100 ---------- ? 0010 I think, but don't know how to deal with the top bit. seems used to indicate sign or what? cuz 1010 in decimal is 10, and 1100 in decimal is 12, if by decimal operation, the result should be -2, which is - 0010. not sure about that. I mean do I have to do this with UNSIGNED binary numbers? Link to comment Share on other sites More sharing options...
Nollog Posted January 11, 2004 Share Posted January 11, 2004 I like twos complement :) Link to comment Share on other sites More sharing options...
evan Posted January 11, 2004 Author Share Posted January 11, 2004 Binary subtraction is just like decimal subtraction.... but different... :rofl: 01 -01 === 00 10 -01 === 01 When you subtract binary, and you have a 1-0 situation, subtract 1 from the binary digit to the left, and make the 0 a 2. [btw, in your example 2, since you are subtracting a larger number from a smaller one (and the numbers are unsigned), then you get an underflow condition] so what's the answer to it? Link to comment Share on other sites More sharing options...
Nollog Posted January 11, 2004 Share Posted January 11, 2004 Answer = 00000010 (-2). (In 8bit Twos Complement) ...edited... 2 would be 10000010 and it's 7bit + a signed bit ...edited... Link to comment Share on other sites More sharing options...
Dudda Posted January 11, 2004 Share Posted January 11, 2004 1010 - 1100 10 - 12 = -2 = 1110 or = -0010 depends how u represent a negative binary number Link to comment Share on other sites More sharing options...
evan Posted January 11, 2004 Author Share Posted January 11, 2004 1010 - 110010 - 12 = -2 = 1110 or = -0010 depends how u represent a negative binary number 1110, that's in 2's complements, but the problem is what "kind" of answer should I give to that specific question which required as UNSIGNED numbers? thx. Link to comment Share on other sites More sharing options...
Dudda Posted January 11, 2004 Share Posted January 11, 2004 what exactly is an UNSIGNED number? Link to comment Share on other sites More sharing options...
Nollog Posted January 11, 2004 Share Posted January 11, 2004 unsigned means only positive numbers. unsigned, the answer is either "undefined" or 0 Link to comment Share on other sites More sharing options...
evan Posted January 11, 2004 Author Share Posted January 11, 2004 what exactly is an UNSIGNED number? not using any signed representation like sign & magnitude, 1's complement, 2's complement etc. Link to comment Share on other sites More sharing options...
markwolfe Veteran Posted January 11, 2004 Veteran Share Posted January 11, 2004 not using any signed representation like sign & magnitude, 1's complement, 2's complement etc. You can also think of it as a normal "byte". It is (typically) unsigned, therefore, it has the range of: 00000000 = 0 to 11111111 = 255 Link to comment Share on other sites More sharing options...
Recommended Posts