Question while doing Two's Complement conversion

104 views Asked by At

I was doing some exercises but had a doubt regarding the amount of numbers that are representable with a n number of bits. The question is: "Consider a 12 bit quantity represented as 7650(8). Compute the corresponding signed decimal value assuming a two’s complement 12 bit binary representation."

With 12 bits the number of representable numbers are [-2048,2047] (These are decimal numbers, right?)

7650(8) is 4008(10) which isn't within the range of representable numbers for 12 bits. How am I supposed to answer this question?

Ignoring the range of representable numbers with 12 bits:

To convert something to Two's Complement I'd start with converting the said number to Decimal and then to Binary. If there are any empty bit positions left, we'd fill them with 0's. For instance, 10(10) = 1010(2) which in Two's Complement is: 00001010 (4 zeros added to the left due to it being short 4 bit positions). In this case, there wouldn't be any need to add 0's, since: 7650(8) = 111110101000(2). But this wouldn't be the 7650(8) in Two's Complement, right? Since the MSB in 1.

I am very confused regarding Two's Complement and can't make any sense of it. Any help?

0

There are 0 answers