
Bob A. answered 08/21/14
Tutor
4.9
(127)
20 Years Making Science and Maths Understandable and Interesting!
Twos Complement is an operation on a Binary number.
(You could have a threes complement on a base 3 number etc.)
Twos Complement is the way computers subtract numbers.
To subtract A from B you take the Twos Complement of A and Add it to B.
Negative numbers are represented by the two's complement of the positive number.
Here is how you do a Twos Complement:
Write out the binary number.
Invert each digit. (0=>1, 1=>0)
Then do a binary addition of one to that result.
3 is 11 in binary (in 2 bit representation)
invert it => 00
now add 1 => 01
so 01 is the Twos Complement of 3 (or a -3 that would be added to another number)
invert it => 00
now add 1 => 01
so 01 is the Twos Complement of 3 (or a -3 that would be added to another number)
3 is 0011 in binary (in 4 bit representation)
invert it => 1100
now add 1 => 1101
so 1101 is the Twos Complement of 3 (or a -3 that would be added to another number)
10 is 1010 in binary
invert it => 0101
add 1 => 0110
so 0110 represents a negative 10
Now the answer to your question depends.
Does your professor want you to find the 2's complement of 14
so that you could then add it to another number thereby
subtracting 14 from that other number? e.g. 23 +(-14)
OR does your professor want you to find the 2's complement of -14
so that you could then add it to another number thereby
subtracting a -14 from another number e.g. 23 +(-(-14))
I will assume that you are trying to subtract 14 from some other number
So 14 is 1110 in binary (or using 5 bits 01110)
invert it => 10001
add 1 => 10010
So 10010 is 2's complement of 14 and you could send that binary number along with another number X into an adder circuit to subtract 14 from X.


Bob A.
OOPs -
A sentence got left off by accident. Just above "Before calculators" should be.
In out base 10 system we have 9's complement and 10's complement.
Report
08/21/14
Bob A.
08/21/14