- #1
amaresh92
- 163
- 0
in 2's complement the negative of 1 is "111". but it also signifies 7 in decimal. how does this -ve 1 is differ from 7?
thanks
thanks
Assuming 3 bits, the only difference is in the interpretation.amaresh92 said:in 2's complement the negative of 1 is "111". but it also signifies 7 in decimal. how does this -ve 1 is differ from 7?
thanks
A 2's complement is a mathematical operation used in computer systems to represent negative numbers. It involves taking the binary representation of a positive number and inverting all the bits, then adding 1 to the result. This allows for the representation of both positive and negative numbers using only binary digits.
In 2's complement, negative one is represented as all 1's in binary (11111111) and seven is represented as 0111. The main difference between these two numbers is the first bit, which is the sign bit. In negative one, the sign bit is 1, indicating a negative number, while in seven, the sign bit is 0, indicating a positive number.
In 2's complement, arithmetic operations are performed by converting the numbers to their binary representation, then using the standard rules of binary arithmetic. The result is then converted back to its 2's complement representation. This makes it easy to perform addition and subtraction of both positive and negative numbers.
The main advantage of using 2's complement is that it allows for the representation of negative numbers using only binary digits. This simplifies arithmetic operations and reduces the complexity of computer systems. It also eliminates the need for a separate sign bit, making it more efficient in terms of memory usage.
In 2's complement, comparison between two numbers is done by subtracting one number from the other and then checking the sign bit of the result. If the sign bit is 0, then the first number is greater than the second number. If the sign bit is 1, then the first number is less than the second number. In the case of negative one and seven, since negative one has a sign bit of 1 and seven has a sign bit of 0, negative one is considered to be less than seven.