When I was studying C programming (long time ago). There were something about negative value called 1's and 2's complement. I don't remember, what are they. Could anyone please explain, in order that I can recall them.
When I was studying C programming (long time ago). There were something about negative value called 1's and 2's complement. I don't remember, what are they. Could anyone please explain, in order that I can recall them.
Here is a crazy idea that seems to have caught on in this day and age:
Beware the fury of a patient man.
One's compliment simple reverses the bits in a value:
10010111 becomes 01101000
It's the compliment created by the NOT operator !
Two's compliment reverses then adds one to the value:
10010111 becomes 01101001
This is the function of the negate operator -
So to create a negative value, the compiler will use the two's compliment:
000001
111110 -- NOT the value
111111 -- add 1
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers