You specified that your number is in the additional code. For further conversion, you need to get a direct number code. Therefore, let\'s perform the conversion from additional code to direct code.
to do this, first perform the conversion from the additional code to the reverse by subtracting 1 bit, then get the direct code by inverting all the bits except the signed one.
| | | | | | | | | |
| 1 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | twos-complement |
| | | | | | - | 1 | -1 bit |
| 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | ones complement |
| 1 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | direct code |
got It:11010111
let\'s translate to decimal like this:
1∙27+1∙26+0∙25+1∙24+0∙23+1∙22+1∙21+1∙20 = 1∙128+1∙64+0∙32+1∙16+0∙8+1∙4+1∙2+1∙1 = 128+64+0+16+0+4+2+1 = 21510
got It: 110101112 =21510