Two's complement: Am I on the right track here?

  • Thread starter Thread starter Horizyn
  • Start date Start date
  • Tags Tags
    Track
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 2K views
Horizyn
Messages
2
Reaction score
0
What is the the 2's complement representation of -14 using 5 bits?

1. (11110)2
2. (10100)2
3. (11001)2
4. (10010)2

I've changed to binary: 01110
Flipped over as in two's complement: 10010

So the likely answer seems to be option 4

Am I missing something?

Thanks
 
Physics news on Phys.org
To take the negative of a number in two's complement, you can take the one's complement (invert all the bits), then increment by 1. In this case ~01110 = 10001, then increment by 1 = 10010. Negating again, ~10010 = 01101, then increment by 1 = 01110.