1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: 2's Complement Addition

  1. Apr 1, 2012 #1
    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. jcsd
  3. Apr 1, 2012 #2


    User Avatar
    Science Advisor

    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.
  4. Apr 1, 2012 #3
    For starters, you're not even converting the numbers to decimal correctly.
    [tex]A = f(B) = b_02^0 +b_12^1 +b_22^2 + ... + b_{n-1}2^{n-1} -b_n2^n[/tex]
    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.
  5. Apr 1, 2012 #4


    User Avatar
    Homework Helper

    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook