What is the correct 6-bit 2's complement representation of -32?

  • Thread starter TheMathNoob
  • Start date
In summary: But I'm not sure that's what the book says. It's important to read the book very carefully and make sure you understand what it's saying.
  • #1
TheMathNoob
189
4

Homework Statement


write the 6-bit 2's complement representation of -32

Homework Equations

The Attempt at a Solution


the only way to represent the magnitude 32 in binary is by using 6 bits, so it would be 100000. This is a little bit confusing to me hence in 2's complement we always use the most significant bit to indicate negativeness or positiveness. If 100000 is in 2's complement then it should be a negative number and it is if we just apply the math on it. I think that one more bit will be needed but the book says otherwise. 32 in 2's complement in 6 bits is 100000 and -32 in 2's complement 6 bits is 100000.
 
Physics news on Phys.org
  • #2
TheMathNoob said:

Homework Statement


write the 6-bit 2's complement representation of -32

Homework Equations

The Attempt at a Solution


the only way to represent the magnitude 32 in binary is by using 6 bits, so it would be 100000. This is a little bit confusing to me hence in 2's complement we always use the most significant bit to indicate negativeness or positiveness. If 100000 is in 2's complement then it should be a negative number and it is if we just apply the math on it. I think that one more bit will be needed but the book says otherwise. 32 in 2's complement in 6 bits is 100000 and -32 in 2's complement 6 bits is 100000.
You didn't write the Relevant Equations. How does 2s complement work? What is zero? What is +1? What is -1?
 
  • #3
You cannot have both ±32 since this would be 65 numbers and 6 bits are only 64 numbers.
 
  • #4
TheMathNoob said:
write the 6-bit 2's complement representation of -32
Hi TheMathNoob:

Unless the notation of for 6 bit representations of numbers has changed since I learned about them many decades ago, this is a trick question. What is the representation of 64 in 6 bit notation?

Hope this helps.

Regards,
Buzz
 
  • #5
Buzz Bloom said:
Hi TheMathNoob:

Unless the notation of for 6 bit representations of numbers has changed since I learned about them many decades ago, this is a trick question. What is the representation of 64 in 6 bit notation?

Hope this helps.

Regards,
Buzz
To my knowledge, it has not changed in 50 years, and it is not a trick question. -32 can be written in 6 bit 2's complement, but +32 cannot.
One way to think of it is that the nth bit from the right, starting at n=0, represents 2n, with the leftmost being negative and the rest positive.
 
  • #6
haruspex said:
-32 can be written in 6 bit 2's complement, but +32 cannot.
Hi haruspex:

Of course you are right. Sloppy thinking on my part, another senior moment. Thanks for your correction.

Regards,
Buzz
 
  • #7
TheMathNoob said:

The Attempt at a Solution


the only way to represent the magnitude 32 in binary is by using 6 bits, so it would be 100000. This is a little bit confusing to me hence in 2's complement we always use the most significant bit to indicate negativeness or positiveness. If 100000 is in 2's complement then it should be a negative number and it is if we just apply the math on it. I think that one more bit will be needed but the book says otherwise. 32 in 2's complement in 6 bits is 100000 and -32 in 2's complement 6 bits is 100000.
I wonder if you're misreading what the book says. Does it really say the six-bit, two's complement representation of +32 is 1000002? Or does it say the binary representation of 32 is 1000002, and then proceed to find the two's complement of that?

If the book says that the two's complement representation of +32 is 1000002, that's incorrect, as others have pointed out.
 

FAQ: What is the correct 6-bit 2's complement representation of -32?

What is a 2's complement problem?

A 2's complement problem is a mathematical concept used to represent negative numbers in binary form. It involves taking the binary representation of a positive number, flipping all the bits, and adding 1 to the result. This allows for efficient subtraction and addition of negative numbers in computer systems.

Why is 2's complement used in computer systems?

2's complement is used in computer systems because it allows for efficient representation and manipulation of both positive and negative numbers using only binary operations. It also avoids the need for a separate subtraction operation.

How does 2's complement handle overflow?

2's complement handles overflow by simply ignoring any extra bits that cannot be represented in the given number of bits. This means that the result may not be accurate, but it prevents errors or crashes in the system.

What is the range of numbers that can be represented using 2's complement?

The range of numbers that can be represented using 2's complement depends on the number of bits used. For example, with 8 bits, the range is -128 to 127. With 16 bits, the range is -32,768 to 32,767.

How is 2's complement used in programming languages?

2's complement is used in programming languages to handle negative numbers and perform arithmetic operations on them. Most modern programming languages have built-in support for 2's complement operations and handle overflow automatically.

Back
Top