Jump to content

Recommended Posts

Posted

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 :/

Posted

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.

Posted

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.

Posted (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 by D H
Posted

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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.