0
$\begingroup$

The question is

Convert the following 16-bit binary numbers to two 8-bit signed integers (two’s complement) in decimal.

i. 0b 0011 0110 1101 0100

I first flipped it and added 1 to it which equaled

0b 1100 1001 0011 1100 which is 51516 in decimal

Is this right? I don't really understand what the question is asking for when it says "two" 8-bit signed integers (two’s complement) in decimal.

$\endgroup$
0
$\begingroup$

That question is not the clearest, but I don't think that's what it asked you to do. "Two’s complement" means two things: a system of mapping between bit-strings and integers in a useful way, and an operation (which you performed) that corresponds to negation under that mapping. This question is not asking you to negate the number, it's asking you to "convert" it.

What sort of conversion we're supposed to be doing is not that clear, but a prime candidate for "converting" a 16 bit number into two 8 bit numbers is to split it down the middle.

So I think the question wants this:

Take 0011 0110, interpret it as a signed 8-bit number, using the two's complement system. So eg 1111 1111 would mean -1, instead of -127 (in the sign and magnitude system) or -0 (in the ones' complement system) or something else. 0011 0110 would mean 54. 1101 0100 is more interesting since it's negative.

$\endgroup$
1
  • $\begingroup$ Thanks! Got the answer. $\endgroup$
    – Tenkin
    Jul 20 at 13:52

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.