Results 1 to 4 of 4

Math Help - 2's complement additions(is my working correct)

  1. #1
    Member
    Joined
    Feb 2009
    Posts
    130

    2's complement additions(is my working correct)

    Hi everyone

    Need help to verify my working,especially for Qiii, the extra 9th bit is not present.

    Perform the arithmetic using 2’s complement notation. The numbers are given in decimal, so first convert them to appropriate form. Make suitable assumptions.
    (i) -29 – 37
    -29 =00011101
    nvert = 11100010+1
    = 11100011

    -37 =00100101
    invert = 11011010+1
    = 11011011

    11100011+11011011=110111110
    =-66

    (ii) 95 – 28
    95=01011111
    -28=00011100
    INVERT=11100011+1=11100100
    01011111+11100100=01000011
    =67

    (iii) 28 – 78
    28=00011100
    -78=01001110=10110001+1=10110010
    00011100+10110010=11001110
    -50


    Thank you for all your kind help & support.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Grandad's Avatar
    Joined
    Dec 2008
    From
    South Coast of England
    Posts
    2,570
    Thanks
    1
    Hello anderson
    Quote Originally Posted by anderson View Post
    Hi everyone

    Need help to verify my working,especially for Qiii, the extra 9th bit is not present.

    Perform the arithmetic using 2s complement notation. The numbers are given in decimal, so first convert them to appropriate form. Make suitable assumptions.
    (i) -29 37
    -29 =00011101
    nvert = 11100010+1
    = 11100011

    -37 =00100101
    invert = 11011010+1
    = 11011011

    11100011+11011011=110111110
    =-66

    (ii) 95 28
    95=01011111
    -28=00011100
    INVERT=11100011+1=11100100
    01011111+11100100=01000011
    =67

    (iii) 28 78
    28=00011100
    -78=01001110=10110001+1=10110010
    00011100+10110010=11001110
    -50


    Thank you for all your kind help & support.
    The assumption we need to make is that this is 8-bit 2's complement. So the valid range of integers is -128 to +127 (decimal).

    Provided we don't overflow this range, we can work to 8 bits and ignore any 9th bit that may arise.

    So in (i) when you add the 2's complement numbers you get:
    ...11100011 +
    ...11011011
    ...---------
    (1)10111110
    Ignoring the overflow 9th bit (1), converting the remaining 8 bits back to decimal gives the answer -66.

    This situation with the overflow bit doesn't arise in (ii) and (iii), so there's no problem with your working.

    Grandad
    Follow Math Help Forum on Facebook and Google+

  3. #3
    MHF Contributor
    Joined
    Dec 2009
    Posts
    3,120
    Thanks
    1
    Quote Originally Posted by anderson View Post
    Hi everyone

    Need help to verify my working,especially for Qiii, the extra 9th bit is not present.

    Perform the arithmetic using 2’s complement notation. The numbers are given in decimal, so first convert them to appropriate form. Make suitable assumptions.
    (i) -29 – 37
    29 =00011101
    invert all bits and add 1..... 11100010+1
    -29= 11100011 in 2's complement form

    37 =00100101
    invert and add 1....= 11011010+1
    -37 = 11011011 in 2's complement form

    11100011+11011011=110111110
    =-66

    (ii) 95 – 28
    95=01011111
    28=00011100
    INVERT and add 1....=11100011+1=11100100=-28 in 2's complement form
    01011111+11100100=01000011
    =67

    (iii) 28 – 78
    28=00011100
    78=01001110 which is 10110001+1=10110010 in 2's complement form
    00011100+10110010=11001110
    -50


    Thank you for all your kind help & support.
    Your technique is fine..
    just added some annotation.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor undefined's Avatar
    Joined
    Mar 2010
    From
    Chicago
    Posts
    2,340
    Awards
    1
    I agree with the above posts that your working is good.

    You could do problem (i) using only 7 bits if you wanted.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 15
    Last Post: June 8th 2011, 09:49 AM
  2. [SOLVED] Locate relative extrema is this working correct?
    Posted in the Calculus Forum
    Replies: 4
    Last Post: April 1st 2011, 07:16 PM
  3. [SOLVED] Please correct my working for: Factorise z^3 +1 over C.
    Posted in the Algebra Forum
    Replies: 7
    Last Post: February 7th 2011, 12:11 AM
  4. Proving equality of sets, is my working correct?
    Posted in the Discrete Math Forum
    Replies: 5
    Last Post: July 15th 2010, 09:33 AM
  5. [SOLVED] Correct double angle working?
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: April 9th 2010, 01:15 AM

Search Tags


/mathhelpforum @mathhelpforum