Jump to content

Number conversion help?Is this correct?

Featured Replies

Convert -128 ( decimal) to binary,representing the number with Two's complement with 8 bits...when I convert it to binary it is 10000000..so it is already 8 bits, if I put the bit of sign then it is 9 bits...110000000

I also have to convert 115,375 (octal) to binary representing the number with 16 bits,but when I convert it I have 001001101,011111101..which is far more than 16 bits..where am I wrong?

Convert -128 ( decimal) to binary,representing the number with Two's complement with 8 bits...when I convert it to binary it is 10000000..so it is already 8 bits, if I put the bit of sign then it is 9 bits...110000000

I also have to convert 115,375 (octal) to binary representing the number with 16 bits,but when I convert it I have 001001101,011111101..which is far more than 16 bits..where am I wrong?

 

What has gone wrong in your calculation is an overflow. You can't represent +128 in a signed 8 bit value. The number you wrote (10000000) is in fact -128 not +128. All the rest should make sense when you see this.

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.