Converting 2's complement to decimal

  • Thread starter Thread starter dangish
  • Start date Start date
Click For Summary
To convert the binary number 11001100 from 8-bit 2's complement notation to decimal, first recognize that the most significant bit (MSB) is 1, indicating the number is negative. Invert the bits to get 00110011, then convert this to decimal, resulting in 51. Adding 1 gives 52, so the final result is -52. The calculation can also be verified by adding the original binary number to its 2's complement, confirming the result is correct. The final decimal representation of 11001100 in 2's complement is -52.
dangish
Messages
72
Reaction score
0
Convert the binary number 11001100 from 8-bit 2’s complement notation to decimal. Remember to specify the sign of the decimal number.

attampt: because the MSB is 1, the number is negative, therefore invert all the numbers getting:

00110011

now convert that to decimal which is, 2^0 + 2^1 + 2^4 + 2^5 = 51

then add 1, 51+1 = 52

and make that negative getting -52. Is this correct?
 
Physics news on Phys.org
dangish said:
Convert the binary number 11001100 from 8-bit 2’s complement notation to decimal. Remember to specify the sign of the decimal number.

attampt: because the MSB is 1, the number is negative, therefore invert all the numbers getting:

00110011

now convert that to decimal which is, 2^0 + 2^1 + 2^4 + 2^5 = 51

then add 1, 51+1 = 52

and make that negative getting -52. Is this correct?
Yes, although I would invert the binary bits and add 1 then, which gives you 00110100.

The check is that 11001100 + 00110100 == 00000000, and in fact, it is. (There's a final 1 bit, but it's out too far to fit in 8 bits.)
 
Since you know its 2's complement and therefore the first number is a negative, can't you just add the bits like normal?

-128 + 64 + 0 + 0 + 8 + 4 + 0 + 0 = -52
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K