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: 16-bit hexadeciaml stored in sign-magnitude

  1. Jan 26, 2012 #1
    1. The problem statement, all variables and given/known data

    What is the sum of A and B if they represent signed 16-bit hexadecimal numbers stored in sign-magnitude format?

    A = 0D34
    B = DD17

    2. Relevant equations

    A + B = C :)

    3. The attempt at a solution

    so far the hexadecimal can be converted to binary numbers

    A = 0000 1101 0011 0100
    B = 1101 1101 0001 0111

    since the hexadecimal is stored in sign-magnitude, then the most significant bit, controls the sign either plus or minus (in this case its -)

    Therefor i write the following

    0000 1101 0011 0100
    -0101 1101 0001 0111
    ???? 0000 0001 1101

    I'm stuck afterwards, because where do i borrow or get the last bits?

    Because when i use a binary calculator i get the following result
    1100 1111 1110 0011 => CFE3

    I would like to understand how to get this result, not just use the calculator...
    1. The problem statement, all variables and given/known data

    2. Relevant equations

    3. The attempt at a solution
  2. jcsd
  3. Jan 26, 2012 #2


    Staff: Mentor

    you do realize that B is negative right because its sign bit is on, so you adding a positive number and a negative number.

    Your mistake is in flipping the sign bit and subtracting the B.

    Remember in binary:
    - a plus ONE is 0000 0000 0000 0001 and
    - a minus ONE is 1111 1111 1111 1111

    (((ie a minus ONE is not the sequence 1000 0000 0000 0001)))

    and when you add them together what do ya get? and where did the carry bit go?
    Last edited: Jan 26, 2012
  4. Jan 26, 2012 #3


    User Avatar
    Gold Member

    Scooooty: You should check out two's compliment, which is what jedishrfu is discussing.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook