<<< Addition of two 2's complement integers | Index | Decimal to Binary Conversion >>> |
If number is negative,
find 2's complement of the positive number of the same magnitude.
For example, to find decimal value of 8-bit number 11000111,
Calculate its 2's complement: 00111001.
Then use the formula:
0*27 + 0*26 + 1*25 + 1*24 + 1*23 + 0*22 + 0*21 + 1*20 = 32+16+8+1 = 57
Finally, add the minus sign: the answer is -57.
<<< Addition of two 2's complement integers | Index | Decimal to Binary Conversion >>> |