# 16-bit hexadeciaml stored in sign-magnitude

1. Jan 26, 2012

### Scooouuuty

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. Jan 26, 2012

### 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
3. Jan 26, 2012

### 256bits

Scooooty: You should check out two's compliment, which is what jedishrfu is discussing.