CEStudent92 Posted November 16, 2012 Posted November 16, 2012 Do the subtraction of 11000-01001 in two's complement. So I have to convert the "01001" in two's complement and then add 11000 to it...So basically is -24-(+9) and the result should be 33 but what I get isnt 33..help :/
D H Posted November 16, 2012 Posted November 16, 2012 That first number isn't -24. It's either +24 or -8, the former if numbers are more than 5 bits long, the latter if numbers are 5 bits long.
CEStudent92 Posted November 17, 2012 Author Posted November 17, 2012 That first number isn't -24. It's either +24 or -8, the former if numbers are more than 5 bits long, the latter if numbers are 5 bits long. You are wrong.The first number starts with 1 so it is negative.
D H Posted November 17, 2012 Posted November 17, 2012 (edited) No, I'm not wrong. With two's complement and five bit binary numbers, how is -8 represented? Answer: 8 is 01000. The one's complement is 10111, two's complement is 11000. -8 is 11000. So with two's complement and five bit binary numbers, how is (-8)-(+9)=-17 represented? Answer: You can't represent 17 or -17 in a five bit binary number. The largest positive number is 15, the largest negative number, -16. You can perform the operation anyhow, but you'll get overflow. Edited November 17, 2012 by D H
CEStudent92 Posted November 17, 2012 Author Posted November 17, 2012 No, I'm not wrong. With two's complement and five bit binary numbers, how is -8 represented? Answer: 8 is 01000. The one's complement is 10111, two's complement is 11000. -8 is 11000. So with two's complement and five bit binary numbers, how is (-8)-(+9)=-17 represented? Answer: You can't represent 17 or -17 in a five bit binary number. The largest positive number is 15, the largest negative number, -16. You can perform the operation anyhow, but you'll get overflow. Right,this was the mistake I was making! Because I got the answer -17 and I wondered how..thanks!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now