Two's compliment of SIGNED binary

  • Thread starter fractal01
  • Start date
  • Tags
    Binary
In summary: You are right. He just looked at a different question when he was writing the problem I think.In summary, the twos complement for regular binary numbers involves replacing all 1's with 0's and all 0's with 1's, then adding 1. This applies to "signed" numbers as well. There are other representations such as 1's complement and a representation with a separate sign bit, but these are not considered regular binary numbers.
  • #1
fractal01
14
1
The twos compliment for regular binary numbers- you just replace all 1's by 0's and 0's by 1's and then +1. So how would you go about finding out for signed...I have got as far as changing the first digit then that's it! Does anyone know what to do?
 
Physics news on Phys.org
  • #2
Hi fractal01! :smile:

"Signed" is the same thing (at least in 2's complement, which is pretty standard).

Suppose you take the number 1.
The binary representation is: 0001
The 2's complement is 1110+1=1111.
This is the same as the representation for -1.

Suppose you add them:
0001 + 1111 = (1)0000.

Yes! It is zero! (disregarding the carry over)
 
  • #3
I like Serena said:
Hi fractal01! :smile:

"Signed" is the same thing (at least in 2's complement, which is pretty standard).Yes! It is zero! (disregarding the carry over)

Hey! Thank you so much! My lecturer gave us some questions and in one of the answers he came up with something completely different and it was the only example so I have been struggling over it for at least half an hour! Everyone is human I guess and makes mistakes...but are you sure that this is the only way of calculating this?
 
  • #4
fractal01 said:
...but are you sure that this is the only way of calculating this?

This is the way the 2's complement representation and its associated "signed" works.

There are other representations, such as 1's complement (unusual), and a representation with a separate sign bit (used for floating point), but those are not "regular" binary numbers.

So what did your lecturer come up with?
 
  • #5
It could be sign-magnitude representation.
 
  • #6
aralbrec said:
It could be sign-magnitude representation.

That's what I said or what I at least intended:
"a representation with a separate sign bit (used for floating point)"
 
  • #7
I like Serena said:
That's what I said or what I at least intended:
"a representation with a separate sign bit (used for floating point)"

Thanks for all of your help! You are right. He just looked at a different question when he was writing the problem I think.
 
  • #8
aralbrec said:
It could be sign-magnitude representation.
Thanks
 

1. What is the purpose of using Two's Compliment in Signed Binary?

In signed binary, the most significant bit (MSB) represents the sign of the number, with 0 being positive and 1 being negative. Two's compliment allows for a more efficient way to represent negative numbers in binary, by inverting all the bits in a positive number and adding 1. This simplifies the mathematical operations involved in working with negative numbers in binary.

2. How is the Two's Compliment of a Signed Binary number calculated?

To calculate the two's compliment of a signed binary number, the bits are inverted (0 becomes 1 and 1 becomes 0) and then 1 is added to the result. This is equivalent to subtracting the original number from 2^n, where n is the number of bits in the binary number. For example, to find the two's compliment of -5 in an 8-bit binary:
-5 = 11111011 (inverted)
+1 = 11111100 (two's compliment)

3. Can a signed binary number be represented without using Two's Compliment?

Yes, a signed binary number can also be represented using a sign-magnitude system, where the MSB represents the sign and the remaining bits represent the magnitude of the number. However, this method requires additional operations for basic arithmetic and does not have a unique representation for 0, making it less efficient compared to the two's compliment system.

4. What is the range of numbers that can be represented using Two's Compliment in signed binary?

In an n-bit binary, the range of numbers that can be represented using Two's Compliment is -2^(n-1) to 2^(n-1)-1. For example, in an 8-bit binary, the range is -128 to 127. The maximum positive number that can be represented is one less than the maximum negative number, due to the inclusion of 0 as a positive number.

5. How is the Two's Compliment of a negative number converted back to its original value?

To convert the Two's Compliment of a negative number back to its original value, the bits are inverted and 1 is added to the result. This is equivalent to subtracting 1 from the two's compliment and then inverting the bits. For example, to convert the two's compliment of -5 back to its original value:
11111100 (inverted)
-1 = 11111011 (original value)

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Replies
4
Views
819
  • Programming and Computer Science
Replies
3
Views
928
  • Engineering and Comp Sci Homework Help
Replies
2
Views
10K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
Back
Top