Jump to content

Two's complement question,is this correct?

Featured Replies

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

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.

  • Author

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.

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

  • Author

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!

Archived

This topic is now archived and is closed to further replies.

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.