As we all no doubt know, the ISO C standard (and C++ as well, I think, though I'm more interested on the C side) allows three underlying representations of signed numbers:
Wikipedia's entry states that sign/magnitude is used on the IBM 7090 from the 60s, and that ones' complement is used by the PDP-1, CDC 160A and UNIVAC 1100, all of which date back to the 60s as well.
Are there any other implementations of C (or underlying hardware) with these alternative representations, that have come out a little more recently than fifty years ago (and what are they)?
It seems a little wasteful to keep something in a standard for machines no longer in existence.
C and C++ as specified, however, are not two's complement. Signed integers currently allow the existence of an extraordinary value which traps, extra padding bits, integral negative zero, and introduce undefined behavior and implementation-defined behavior for the sake of this extremely abstract machine.
So if your bytes are more than 3 bits long, 100 will always be 8, not -4. Not every computer uses two's complement technically speaking, but it is very rare to find one that doesn't these days.
Another method of representing signed numbers is two's complement. Most computers use this method to represent negative numbers. This method can be more effective when performing mathematical operations like adding and subtracting.
The most recent example I can find is the UNISYS 2200 series, based on UNIVAC, with ones-complement arithmetic. The various models were produced between 1986 and 1997 but the OS was still in active development as late as 2015. They also had a C compiler, as seen here.
It seems likely that they may still be in use today.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With