16-bit hexadeciaml stored in sign-magnitude

  • Thread starter Thread starter Scooouuuty
  • Start date Start date
Click For Summary
SUMMARY

The discussion focuses on the addition of two signed 16-bit hexadecimal numbers, A = 0D34 and B = DD17, stored in sign-magnitude format. The most significant bit indicates the sign, with B being negative due to its sign bit being set. The correct approach involves flipping the sign bit of B and performing binary subtraction instead of direct addition. The participants emphasize the importance of understanding binary arithmetic, particularly the handling of sign bits and carry bits in calculations.

PREREQUISITES
  • Understanding of 16-bit hexadecimal representation
  • Knowledge of sign-magnitude format for binary numbers
  • Familiarity with binary arithmetic operations
  • Concept of two's complement for signed numbers
NEXT STEPS
  • Study the process of converting hexadecimal to binary and vice versa
  • Learn about sign-magnitude representation and its implications in arithmetic
  • Explore two's complement and its advantages over sign-magnitude
  • Practice binary addition and subtraction with signed numbers
USEFUL FOR

Students studying computer science, software engineers working with low-level data representations, and anyone interested in understanding binary arithmetic and signed number formats.

Scooouuuty
Messages
1
Reaction score
0

Homework Statement



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

Homework Equations



A + B = C :)

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...
 
Physics news on Phys.org
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 you get? and where did the carry bit go?
 
Last edited:
Scooooty: You should check out two's compliment, which is what jedishrfu is discussing.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
11K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
3
Views
4K
  • · Replies 19 ·
Replies
19
Views
36K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K