Adding and subtracting signed hex numbers

Thread Starter

mad12

Joined Oct 9, 2008
11
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
 

Attachments

Thread Starter

mad12

Joined Oct 9, 2008
11
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
0000 1101 0011 0111 + 1101 1101 0001 0111
Since the second number is negative as indicated by the MSB, I would just take the 2's complement to get
0010 0010 1110 1001
and then the addition would look like this:
0000 1101 0011 0111
0010 0010 1110 1001 +
0011 0000 0010 0000
Is that all that is necessary? Thanks again
 

Ratch

Joined Mar 20, 2007
1,070
mad12,

Is that all that is necessary?
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:

Hawkeye87

Joined Oct 7, 2008
52
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.
 
Top