computerbum Posted September 17, 2009 Posted September 17, 2009 I am trying to understand what how to use two's complement. If I have the number 128, I know that I can find the number by converting 128 to binary such as: 0000 0000 1000 0000 Then invert the digits like so: 1111 1111 0111 1111 Then add one to it like so: 1111 1111 1000 0000 which will give me -128 but what about if I want to find 2's complement of -128 would I still do it the same way as above which would give me the value of 128? I am new at this please help?
D H Posted September 17, 2009 Posted September 17, 2009 Try it. What does inverting the digits and adding one do to 1111 1111 1000 0000 ?
davemattie Posted September 24, 2009 Posted September 24, 2009 @ computerbum The two's complement of a negative number is always the corresponding positive value. For example, inverting the bits of −5 (above) gives: 00000100 And adding one gives the final value: 000001012 = 5
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now