1. Apr 1, 2012

### TranscendArcu

Do the following additions in 8-bit binary two's complement:

a) 01110110 + 10001001 = (64+32+16+4+2) + (-(64+32+16+4+2+1)) = 118 -119 = -1
b) 11010101 + 10101010 = -(64+16+4+1) + (-(64+16+4+1+1)) = -86 -87 = -171

Have I done these correctly?

2. Apr 1, 2012

### HallsofIvy

Staff Emeritus
You do understand that converting to base 10 combining adding those is NOT "twos complement" don't you?

What is the "twos complement" of 10001001.

3. Apr 1, 2012

### RoshanBBQ

For starters, you're not even converting the numbers to decimal correctly.
$$A = f(B) = b_02^0 +b_12^1 +b_22^2 + ... + b_{n-1}2^{n-1} -b_n2^n$$
where A is the base 10 representation, B is a binary 2's complement representation of a number with n+1 digits with b_0 being the least significant digit. Note that only the last digit has a minus sign.

4. Apr 1, 2012

### rcgldr

For two's complement addition in binary, you just add the two numbers as if they were unsigned binary numbers (ignoring any carries past the most significant bit), to get the sum. I don't know if this assignment requires that you indicate if signed overflow has occurred.