Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2's compliment

 
cybel sheriden
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

2's comliment of negative value is .....flip all bits and add 1.
2's compliment of positive value ......is it the same way
 
fred rosenberger
lowercase baba
Bartender
Posts: 12126
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cybel,

the process of 2's complement really doesn't know anything about positive or negative. it just means "flip the bits and add 1".

How those bits are interpreted are up to you (and the computer). If you're really asking "how do i find the bit pattern of a negative integer", or "what integer is represented by such-and-such a bit pattern" that's a little different.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic