3 ms·
yes, but my original comment did say don't "think" of it as a sign bit rather than don't call it that. and one's complement is a complement, but two's compleme
by fsckboy 4y ago
yes, but my original comment did say don't "think" of it as a sign bit rather than don't call it that.
and one's complement is a complement, but two's complement isn't really. It does turn out that if you take the complement and add one you get the right value, but a better way to think of it (on byte scale e.g.) is "take a modulo-256 dial, now change the labeling counter clockwise from the top to negative numbers because you note that 255+1 is 0 just like -1+1 is 0". I just think this explanation serves beginning C or ASM programmers better because it's more mentally agile.
I learned it what I would call "the dumb way", but since I was amazed that it worked I studied it to convince myself it was true and then I realized what was actually going on.