0
$\begingroup$

"Explain how negative numbers are represented."

My answer is that if we ie. have the number 3 and want to convert that to -3 i do as follows: 3 = 0011 in 4 bits. i switch the 1s and 0s => 1100 and then add 1 => 1101, 1101 = -3.

Is this correct answer? and will that hold for 5,6,7... bits? Maybe someone can help me generalize it a bit more?

$\endgroup$
  • $\begingroup$ Thank you! that was a good explanation. Follow-up question: To find the highes and lowes possible number with 6 bits, i need to find log2(x) < 6 where x is my number right? and how do i do that for a negative? $\endgroup$ – KimR Nov 9 '14 at 13:49
  • $\begingroup$ It might also be helpful to know that, in 6-bit 2's complement number, each digit has a place value: $$000011_2 = 0\times\left(\color{red}-2^5\right)+0\times2^4+0\times2^3+0\times 2^2 + 1\times2^1 + 1\times 2^0 = 3$$ and similarly$$111101_2 = 1\times\left(\color{red}-2^5\right)+1\times2^4+1\times2^3+1\times 2^2 + 0\times2^1 + 1\times 2^0 = -3$$. You can try to figure out how to form the most positive and most negative numbers with 6 bits. $\endgroup$ – peterwhy Nov 9 '14 at 14:11
  • $\begingroup$ so i "turn on" each place on positive numbers, which gives med 31, and turn off each negative so i get -32. Correct? Maks = 31 and min = -32 $\endgroup$ – KimR Nov 9 '14 at 14:33
  • $\begingroup$ Correct, and notice this pattern: there is one more negative number than positive number. (Why aren't they the same?) Can you generalise that to, say, 8-bit signed number? $\endgroup$ – peterwhy Nov 9 '14 at 14:41
  • $\begingroup$ Because the leftmost number is reserved for the negative number. So i have one bit less to describe the positive number (or something like that). Thanks for the help peterwhy :) $\endgroup$ – KimR Nov 9 '14 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.