16-bit hexadeciaml stored in sign-magnitude

  • Thread starter Scooouuuty
  • Start date
In summary: Basically, it's a way to represent negative numbers in binary by flipping the bits and adding one. So for B, the two's complement would be 0011 1101 1110 1001, which is what you get when you flip the bits (1101 1101 0001 0111) and add one. So when you add A and B (in two's complement form), you get 0000 0010 0000 0001, which is equal to CFE3 in hexadecimal. In summary, the sum of A and B, which represent signed 16-bit hexadecimal numbers stored in sign-magnitude format, is equal to 0000 0010 0000 0001 or
  • #1
Scooouuuty
1
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
  • #2
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:
  • #3
Scooooty: You should check out two's compliment, which is what jedishrfu is discussing.
 

What is a 16-bit hexadeciaml stored in sign-magnitude?

A 16-bit hexadeciaml stored in sign-magnitude is a way of representing numerical values in a computer's memory. It uses 16 bits, or binary digits, to store a number in the hexadecimal system, which has a base of 16. The sign-magnitude format indicates both the magnitude and the sign of the number, with the first bit representing the sign and the remaining 15 bits representing the magnitude.

How does a computer store a 16-bit hexadeciaml in sign-magnitude?

A computer stores a 16-bit hexadeciaml in sign-magnitude by assigning the first bit as the sign bit, with 0 representing a positive number and 1 representing a negative number. The remaining 15 bits are used to represent the magnitude of the number in binary form, with the most significant bit on the left and the least significant bit on the right.

What is the range of values that can be stored in a 16-bit hexadeciaml in sign-magnitude?

A 16-bit hexadeciaml in sign-magnitude can store values ranging from -32767 to 32767. This is because the first bit, the sign bit, takes up one bit, leaving 15 bits to represent the magnitude. In binary, 15 bits can represent numbers from 0 to 32767, and the sign bit allows for the representation of both positive and negative numbers within that range.

How does the sign-magnitude format differ from other formats?

The sign-magnitude format differs from other formats, such as two's complement, in the way it represents negative numbers. In sign-magnitude, the first bit represents the sign, while in two's complement, negative numbers are represented by inverting the bits and adding 1. Additionally, sign-magnitude can represent both positive and negative numbers in the same way, while two's complement has a larger range of positive numbers but a smaller range of negative numbers.

What are some advantages and disadvantages of using sign-magnitude to store numbers?

One advantage of using sign-magnitude to store numbers is that it can represent both positive and negative numbers, making it more versatile. Another advantage is that it is easy to convert between binary and hexadecimal representations in this format. However, a disadvantage is that it requires more bits to represent a number compared to other formats, such as two's complement. It also has two representations for zero, +0 and -0, which can cause confusion in some situations.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
10K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
991
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
19
Views
34K
Back
Top