Adding and subtracting signed hex numbers

Discussion in 'Homework Help' started by mad12, Feb 26, 2009.

  1. mad12

    Thread Starter Member

    Oct 9, 2008
    11
    0
    I am working on a homework problem that is requiring us to add and subtract signed hex numbers. My first step was converting is to its binary form, and I understand that the MSB represents the sign of the overall number, however when I do the addition and subtraction I get the same results as if they were unsigned numbers. My textbook does not go over how to treat them differently so I was wondering if I was doing it correctly, or if there was a certain way to do it. My work and questions are attached to look at. Thanks in advance!! :D
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
  3. mad12

    Thread Starter Member

    Oct 9, 2008
    11
    0
    Thanks for the link. If I am understanding it correctly, I would just take the 2's complement of the number and then add the two together?

    for example I have
    Since the second number is negative as indicated by the MSB, I would just take the 2's complement to get
    and then the addition would look like this:
    Is that all that is necessary? Thanks again
     
  4. Ratch

    New Member

    Mar 20, 2007
    1,068
    3
    mad12,

    What are you doing? Your example shows a sum of a negative and postive number. Why not simply add the numbers. Why do you figure out the negative of one of the numbers first before adding it? That makes your answer is wrong. If you insist on doing that, then you must subtract the negative of the number.

    Same with your problems. Why not simply subtract the numbers instead of doing a subtractive addition. Wouldn't that be simpler?

    Ratch
     
    Last edited: Feb 27, 2009
  5. Hawkeye87

    Active Member

    Oct 7, 2008
    52
    0
    you could always use the calculator on Windows XP but click view and click scientific and you'll see a hex bubble and you should be able to add and subtract hex numbers and what not.
     
  6. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    This is probably an exercise to show how things worked back when computers could only add.
     
Loading...