0
$\begingroup$

This is what I have so far

1 1 0 0

Switch values by 2s Complement

0 0 1 1 + 1


0 1 0 0

$\endgroup$
7
$\begingroup$

No, it's not possible, at least using the standard representations. An unsigned $n$-bit number can represent any integer in the interval $[0, 2^{n} - 1]$. A signed $n$-bit number using two's complement can represent integers in the interval $[-2^{n - 1}, 2^{n - 1} - 1]$. With $n = 4$, that gives an interval of $[-8, 7]$, which obviously doesn't include $12$. One's complement can use $n$ bits to represent the interval $[-(2^{n - 1} - 1), 2^{n - 1} - 1]$, giving the interval $[-7, 7]$ for four bits, which also doesn't work. You'd have to contrive a nonstandard representation to represent $-12$ in four bits.

$\endgroup$
  • $\begingroup$ Thanks for answering. So, in that case would it be possible to compute −12 in 5 bits and I can state that there is insufficient number of bits or is it arbitrarily unable to represent? $\endgroup$ – Fred Feb 18 '16 at 20:54
  • $\begingroup$ 5 bits would work, yes; 4 is insufficient using the standard forms. An example of a nonstandard representation that would work is a representation that assumes a negative sign in front, which would allow 4 bits to represent $[-15, 0]$, which includes $-12$; however, I don't know that anyone has ever used something like that. $\endgroup$ – DylanSp Feb 18 '16 at 20:59
  • $\begingroup$ You have help me a lot. Thank you so much ! $\endgroup$ – Fred Feb 18 '16 at 21:10
  • $\begingroup$ If the answer satisfies you, you can mark it accepted by clicking the check mark next to the answer's text. $\endgroup$ – DylanSp Feb 18 '16 at 21:11

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.