문제

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:

  • two's complement;
  • ones' complement; and
  • sign/magnitude.

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.

도움이 되었습니까?

해결책

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.

다른 팁

I don't have any conclusive evidence that none exist, but I've never seen one. To my knowledge, all non-twos-complement hardware was obsolete long before C was standardized.

Perhaps the best way to gather evidence would be to look for conflicting requirements and other outright bugs in the standard connected to non-twos-complement systems. If no such implementation has ever been created, it's likely there are oversights in the specification that would become apparent when somebody actually tries to make one.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top