Sign and Magnitude (Hexadecimal and 8-bit

• DarkWing
In summary, the conversation discusses the confusion of implementing sign and magnitude with hexadecimal and 8-bit decimal numbers in a homework assignment. The individual is struggling with understanding how to approach the problem and is seeking clarification on the basics of sign and magnitude with hexadecimal numbers. They mention the leading digit 0-7 representing a positive number and 8-F representing a negative number.
DarkWing
First off sorry, but I did away with the automatic formatting.

For a homework assignment I need to do a few problems which involved adding and subtracting hexadecimal and 8-bit numbers being added and subtracted. I've done the problems that involve the unsigned numbers fine, but I'm confused as to how to approach the ones that are in sign and magnitude format. The book only explains sign and magnitude for binary numbers which does not help me as I'm already familiar with them, but am not sure how to apply it for hexadecimal and 8-bit decimal numbers.

For instance one of the problems is:
part a: if A = 0D34 and B = DD17
part b: A = BA1D and B = 3617
assume the numbers are signed 16-bit hexadecimal numbers stored in sign and magnitude format. What is the sum of A and B.

now part a: A = BA7c and B = 241A
part b: A = AADF and B= 47BE

What is A-B if they represent signed 17-bit hexadecimal numbers stored in sign and magnitude format.

I'm hoping if I can get down the basics of sign and magnitude with hexadecimal numbers that I'll be fine with the rest of the homework.

I'm not asking for anyone to do the assignment, but rather just a quick lesson in how to implement sign and magnitude using hexadecimal numbers.

After more research it appears that if the leading digit is 0-7 the number is positive, but if it is 8-F the number is negative. Is this correct?

I understand your confusion and can provide some insight into how to approach these problems involving sign and magnitude with hexadecimal numbers.

First, let's review what sign and magnitude means. In this format, the most significant bit (MSB) represents the sign of the number, where 0 indicates a positive number and 1 indicates a negative number. The remaining bits represent the magnitude or absolute value of the number.

Now, let's apply this concept to hexadecimal numbers. In a 16-bit signed hexadecimal number, the MSB is the 4th digit from the left, while the remaining 3 digits represent the magnitude. For example, in the number 0D34, the MSB is 0 and the remaining digits represent the magnitude 0D3.

To add or subtract signed hexadecimal numbers in sign and magnitude format, we follow the same rules as with binary numbers. For addition, we add the two numbers as if they were unsigned, and then take into account the sign bit. For subtraction, we subtract the two numbers as if they were unsigned, and then take into account the sign bit by changing the sign of the result if necessary.

Let's look at the first problem: A = 0D34 and B = DD17. To add these two numbers, we simply add them as if they were unsigned: 0D34 + DD17 = 1A04B. However, since the MSB of both numbers is 0, the result is a positive number. Therefore, the sum of A and B is simply 1A04B.

For the second problem, A = BA7C and B = 241A, we follow the same steps: BA7C + 241A = DE96. However, since the MSB of A is 1 and the MSB of B is 0, we need to take into account the sign bit. Since A is negative, we need to change the sign of the result to get the final answer of -DE96.

For subtraction, we use the same approach. Let's look at the last problem: A = AADF and B= 47BE. To subtract B from A, we first subtract the two numbers as if they were unsigned: AADF - 47BE = 63C1. However, since the MSB of A is 1 and the MSB of B is 0, we need to change the sign of the result to

1. What is the Sign and Magnitude representation in hexadecimal?

The Sign and Magnitude representation in hexadecimal is a method of representing numbers using a combination of a sign bit and the magnitude of the number. The sign bit indicates whether the number is positive or negative, and the magnitude is represented in hexadecimal form.

2. How does the Sign and Magnitude representation differ from other number representations?

The Sign and Magnitude representation differs from other number representations, such as Two's Complement, in that it uses a separate bit to indicate the sign of the number. This means that it can represent both positive and negative numbers without the use of a separate negative range of values.

3. What is the purpose of using hexadecimal in the Sign and Magnitude representation?

Hexadecimal is used in the Sign and Magnitude representation because it allows for a more compact representation of numbers. Each hexadecimal digit represents 4 bits, so a 4-digit hexadecimal number can represent a full 16-bit number, making it more efficient than using decimal or binary.

4. How does the Sign and Magnitude representation handle zero and negative zero?

In the Sign and Magnitude representation, positive zero is represented as all 0s, while negative zero is represented as all 1s. This allows for a distinction between the two values, which is important in some mathematical operations.

5. What are the limitations of using Sign and Magnitude representation in 8-bit numbers?

The Sign and Magnitude representation in 8-bit numbers has a limited range of values it can represent. It can only represent numbers from -127 to 127, as one bit is used for the sign and the remaining 7 bits are used for the magnitude. This means it cannot represent larger or smaller numbers without using more bits.

• Engineering and Comp Sci Homework Help
Replies
2
Views
10K
• Engineering and Comp Sci Homework Help
Replies
2
Views
13K
• Engineering and Comp Sci Homework Help
Replies
2
Views
1K
• Introductory Physics Homework Help
Replies
2
Views
597
• Engineering and Comp Sci Homework Help
Replies
4
Views
2K
• Engineering and Comp Sci Homework Help
Replies
10
Views
3K
• General Math
Replies
3
Views
5K
• Engineering and Comp Sci Homework Help
Replies
1
Views
2K
• Engineering and Comp Sci Homework Help
Replies
6
Views
9K
• Precalculus Mathematics Homework Help
Replies
2
Views
2K