Results 1 to 5 of 5

Math Help - 2s Complement

  1. #1
    Member
    Joined
    May 2008
    Posts
    109

    2s Complement

    Can someone explain 2s complement to me?

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

    thanks
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member

    Joined
    May 2006
    From
    Lexington, MA (USA)
    Posts
    11,719
    Thanks
    635
    Hello, sjenkins!

    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 0 is 2

    The 2-complement of 0000101 is 2222121

    The 2-complement of 1101111000 is 1121111222

    Follow Math Help Forum on Facebook and Google+

  3. #3
    Moo
    Moo is offline
    A Cute Angle Moo's Avatar
    Joined
    Mar 2008
    From
    P(I'm here)=1/3, P(I'm there)=t+1/3
    Posts
    5,618
    Thanks
    6
    Hello,

    Quote Originally Posted by Soroban View Post
    Hello, sjenkins!


    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 0 is 2

    The 2-complement of 0000101 is 2222121

    The 2-complement of 1101111000 is 1121111222

    Isn't that binary strings ?

    So that the complement of 1 is 0 and the complement of 0 is 1 ? Like talking about the modulus, in sort of a way..
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Member
    Joined
    May 2008
    Posts
    109
    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?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    May 2008
    Posts
    11
    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.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. two's complement
    Posted in the Number Theory Forum
    Replies: 2
    Last Post: January 26th 2011, 02:06 PM
  2. 10's complement
    Posted in the Advanced Math Topics Forum
    Replies: 2
    Last Post: March 25th 2010, 06:01 PM
  3. complement question..
    Posted in the Advanced Statistics Forum
    Replies: 11
    Last Post: November 23rd 2009, 08:00 AM
  4. Supplement & Complement
    Posted in the Geometry Forum
    Replies: 3
    Last Post: October 15th 2009, 10:51 AM
  5. complement help
    Posted in the Discrete Math Forum
    Replies: 3
    Last Post: September 24th 2009, 10:49 AM

Search Tags


/mathhelpforum @mathhelpforum