See One's complement vs. Two's complement. One's complement representation is symmetric (same max. positive and negative value) and has a negative zero; the negative counterpart of a positive value can be obtained by bitwise negating (the XOR you mentioned) the positive value (and the other way round, of course). Two's complement representation (Perl's native signed int representation), in contrast, doesn't have a negative zero, but one more value on the negative side (e.g. -128..127, for byte size).
In reply to Re: Negating a number
by almut
in thread Negating a number
by flamey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |