1. Not finding help here? Sign up for a free 30min 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!

Sign/magnitude notation

  1. Jul 11, 2010 #1
    Find (-5) to Sign / magnitude notation & Two's Complement in 8 digits
     
    Last edited: Jul 11, 2010
  2. jcsd
  3. Jul 11, 2010 #2
    What have you tried so far? Do you know how to convert 5 into binary? That's your first step.
     
  4. Jul 11, 2010 #3
    umm....
    ex) for 4 digits
    negative = 1000
    positive = 0000

    I guess 5 is a easy small number to make to binary

    3210
    -----
    0101

    is this right ???
    so for Sign/Magnitude
    1101 = -5

    is this right ?

    if this is right. how to convert this to Two's complement ?
     
  5. Jul 11, 2010 #4
    Yeah. The way I learned to take two's complement is if you have a positive number, it is simply that number with a 0 in front to denote positivity. If the number is negative, you take the positive binary representation, invert all of its binary digits, and add one. Remember, if the number is positive, if you can pad the the 2's complement with as many 0s in front as you want. Oppositely, if the number is negative, you can pad the 2's complement with as many 1s in front as you want.

    Example: represent 23 and -23 in 2's complement

    2's complement of 23:
    step 1: find the binary representation of 23
    23 base 10 = 10111 base 2
    step 2: add at least one 0 in front to denote positivity. However, infinitely many is ok
    answer = 010111 or 000010111, etc.

    2's complement of -23:
    step 1 find the binary representation of 23:
    23 base 10 = 10111 base 2
    step 2: pad the number with 0s (you need enough. 1 usually does it). Note, after we take the one's complement (inverting each bit), these 0s will become 1s. Remember, you can pad a negative number with infinitely many 1s.
    00010111
    step 3: invert each bit:
    11101000
    step 4: add 1 to the least significant bit:
    11101001
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Sign/magnitude notation
  1. Sign magnitude number (Replies: 1)

Loading...