Can someone explain 2s complement to me?

I need to know the 2s complement of the following 0 0000101 1101111000.

thanks

Printable View

- Jun 3rd 2008, 12:33 PMsjenkins2s Complement
Can someone explain 2s complement to me?

I need to know the 2s complement of the following 0 0000101 1101111000.

thanks - Jun 3rd 2008, 01:15 PMSoroban
Hello, sjenkins!

Quote:

Can someone explain 2s complement to me?

I need to know the 2s complement of the following: 0 0000101 1101111000.

We need a**lot**more information . . . but I'll take a wild guess . . .

The "2s complement" is found by subtracting each digit from 2.

The 2-complement of is

The 2-complement of is

The 2-complement of is

- Jun 3rd 2008, 01:18 PMMoo
- Jun 3rd 2008, 02:19 PMsjenkins
Yes, it is binary, I'm sorry I didn't say that in the original post. I thought I had but I guess not.

So, if a number is 1011011 the complement is 0100101 right?

But what if it ends in a 0 like 1011010, is the complement 0100100? - Jun 6th 2008, 09:00 AMkjey
If we have a 8-bit representation of a number, for example 1001 0011. To find det complement you just flip the bits and add 1:

0110 1100 + 1 =__0110 1101__.

Example: calculate 123 - 3 (8-bits representation)

123 = 0111 1011

3 = 0000 0011

Complement of 3: 1111 1100 + 1 = 1111 1101

Just add 123 with the complement of 3:

0111 1011 + 1111 1101 =__1__0111 1000

You see that we now have an overflow of 1 bit. We just remove the one bit to the left and get: 0111 1000 =__120__Hope this helps.