Earlier quoted context omitted.
Don't forget about rings.
I always found those ideal.
Two's complement – You beauty
91–92 of 92 posts
Re: Two's complement – You beauty
#92I program a UNISYS 2200 mainframe at work. It uses 1's complement. Yes, there are two zeros. Not a problem in practice because all arithmetic operations normalize -0 to +0 at no extra cost in execution time, so -0 practially doesn't happen. IIRC from Assembler class, addition is implemented as subtraction of the negative operand. Just in case anyone ever needs it, e.g. for bitmaps, the SZ (store zero) assembler instr…
> When reading dumps, not having to perform an extra addition (subtraction?) when changing a number's sign is pretty sweet! So I've not worked with 1's complement machines, but how do you add a negative number to a positive number? For instance, 5 + -3 in one's complement would naively be: 000101 + 111100 -------- 000001 instead of 2 Doesn't the machine have to perform some fixup for negative numbers in this more com…
So the "real" implemented instruction was subtraction, while addition wasn't directly implemented. The "fixup", meanwhile, is just flipping all the bits, and this can be achieved, I suppose, more quickly than adding-with-carry over 36 bits.