1
$\begingroup$

I'm learning 2's complement conversion for positional number systems. For the most part I have only seen 2's complement for represented in 8-bits. I had a discussion with a friend who explained that for values that exceed 8-bits (>255) you would need to go to the next largest word size i.e. 16-bit followed by 32 and 64... That is all well and good, however I don't fully understand if or why I can't do 2's complement for something like a 5-bit, 21-bit, etc system.

For example, if I were to represent 0000 0001 1100 0111 as a 13-bit value I would take off some 0's xxx0 0001 1100 0111, perform some arithmetic to find the complement, xxx1 1110 0011 0001 therefore the 13-bit 2's complement of (0 0001 1100 0111) is (1 1110 0011 0001 0001)? Please let me know if I am missing something...

$\endgroup$
1
$\begingroup$

You can do this for 13 bits, or 15 bits etc, etc.. there is nothing stopping you.

The reason you jump to the next word size is because of the computers hardware. If a register has 8 bits and you are only using 6 bits, the register STILL has 8 bits.

You can design a system with 13 bit word size, and it will still work the same.

$\endgroup$

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.