Binary operation problem

Discussion in 'General Electronics Chat' started by *.*.*AnUm*.*.*, Apr 23, 2015.

  1. *.*.*AnUm*.*.*

    Thread Starter New Member

    Apr 21, 2015
    16
    0
    upload_2015-4-24_23-52-16.png


    Now in 2's complement if I remove left most bit from answer, then will answer become (+3) and (-3) ?

    OR

    Any other method should I use ?

    I am confused, please help me, Thanks.
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,441
    3,361
    There are many ways to represent numbers in binary, whether positive or negative.

    2's compliment is only one of many ways.
     
  3. WBahn

    Moderator

    Mar 31, 2012
    17,743
    4,795
    That chart appears to be making the point that if you blindly do normal binary addition on signed integers that you get the correct answer if the values are represented using 2's compliment and possibly the wrong answer if you used signed-binary.

    The reason for this is because 2's compliment maintains the cyclical ordering of the values represented. The more fundamental reason, but this is probably gibberish to you right now, is that 2's complement preserves the mapping between the n-bit binary bit patterns and the residue classes mod 2^n.

    As for whether removing the leftmost bit from the answer will turn (+3) to (-3). Try it.

    (+3) = 0011
    remove the leftmost bit
    (011) = ???

    Is that -3?

    If not, then you have your answer.

    Now, when you say "any other method you should use", any other method to do what? Turn (+3) to (-3) in 2's complement? There are several ways. The classic way is to apply the defining relationship of 2's complement representation and invert all the bits and add one to the result.
     
    *.*.*AnUm*.*.* likes this.
  4. *.*.*AnUm*.*.*

    Thread Starter New Member

    Apr 21, 2015
    16
    0
    (+3) = 0011
    remove the leftmost bit
    (011) = ???

    Is that -3?

    no

    got it. but I still have little confusion, please see this, how carry is discarding ???

    see attachment for my question.
    Thanks.
     
  5. WBahn

    Moderator

    Mar 31, 2012
    17,743
    4,795
    The carry is discarded because there is not place to store it. You have a four-bit representation, thus you can't store four bits.

    All of the binary representation schemes for signed numbers rely on the use of a fixed-width representation.
     
Loading...