Article View: comp.arch
Article #91Re: two's complement and Flags (Re: arithmetic and endian history)
From: Thomas Koenig
Date: Tue, 13 Oct 2026 21:57
Date: Tue, 13 Oct 2026 21:57
84 lines
5026 bytes
5026 bytes
John Levine <johnl@taugh.com> schrieb:
> According to Tim Rentsch <tr.17687@z991.linuxsc.com>:
>>>> I think this proposed explanation is consistent with the example
>>>> given on page 10 (which doesn't talk about looping) and with the
>>>> description of the "Transfer on Index" instruction give on page 25
>>>> (which clearly is meant to be used with looping). ...
>>>
>>> That's certainly one of the more common guesses people have made.
>>> On the other hand, the TIX instruction adds its decrement field
>>> to an index register, but since the decrement is the same size as
>>> the index, if you want to count down you just make the decrement
>>> two's comp -1. [...]
>>
>>Did you misread the description of the TIX instruction?
>
> Oh, whoops, I confused it with TXI.
>
> Either way, the fact that Fortran stored its arrays backwards
> suggests that whatever they had in mind turned out not to be useful.
It certainly makes sense for a language like Fortran to store the
arrays on the order for the indexing. Putting in the arrays in
ascending order, with code like
DO 10 I=1,10
A(I) = B(I) + C(I)
10 CONTINUE
would have required negating the index registers for the array
indices.
Whatever they had in mind for the negative indexing was something
aimed at assembler or machine code programmers (assemblers still
were considered a luxury in those days). The 704 was introduced
in 1954, and Backus wrote his famous FORTRAN memo late in 1953,
when an optimizing compiler was still a wild idea.
This makes the usual explanation quite likely but, as you
correctly pointed out, that is not proof.
> I sure wish SOMEONE had written down what the motivation was. The
> mixture of sign-magnitude arithmetic in most places and two's
> complement subtraction for indexing is quite peculiar.
The 704 was the successor of the 701, which was also sign-magnitude,
There, the 36-bit adder (despite ripple carry, compounded by
end-around carry) could do its job in 5 microseconds. Using the
same number representation made a lot of sense, both from the
engineering and the customer standpoint. So, quite possibly a
legacy issue.
For the index register, they chose a solution that was simple.
The "Architecture of the IBM System/ 360" article by Amdahl,
Blaauw and Brooks notes that two's complement is better
for addressing modes. They wrote
"For the fixed-point arithmetic
system, which is binary,the two’s complement representa-
tion for negative numbers was selected. The well-known
virtues of this system are the unique representation
of zero and the absence of recomplementation.These
substantial advantages are augmented by several properties
especially useful in address arithmetic, particularly in the
large models, where address arithmetic has its own hard-
ware. With two’s complement notation, this indexing
hardware requires no true/complement gates and thus
works faster. In the smaller, serial models, the fact that
high-order bits of address arithmetic can be elided with-
out changing the low-order bits also permits a gain in
speed."
(One thing that they did not mention was that, for machines which
did the addition piecewise like the 360/30 did, an end-around carry
would have required a second carry propagation trip by microcode.)
This was later, but Amdahl was also involved with the
704, and two's complement subtraction *is* cheaper.
Some things cannot be explained logically, only chronologically.
--
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.
Technical Details
Message-ID:
<11am9g1$uql2$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<10uks4f$1dqo$1@gal.iecc.com> <865wzfm8ph.fsf@linuxsc.com> <11a3at4$17uu$1@gal.iecc.com> <86qzhvi9vn.fsf@linuxsc.com> <11aj5su$29p$1@gal.iecc.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Thomas Koenig <tkoenig@netcologne.de> Newsgroups: comp.arch Subject: Re: two's complement and Flags (Re: arithmetic and endian history) Date: Tue, 13 Oct 2026 21:57:21 -0000 (UTC) Organization: A noiseless patient Spider Lines: 84 Message-ID: <11am9g1$uql2$1@dont-email.me> References: <10uks4f$1dqo$1@gal.iecc.com> <865wzfm8ph.fsf@linuxsc.com> <11a3at4$17uu$1@gal.iecc.com> <86qzhvi9vn.fsf@linuxsc.com> <11aj5su$29p$1@gal.iecc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 13 Oct 2026 21:57:22 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1010338"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+eS2lURUtl8AkLIjsfkwbW6If6pA0M/oo="; posting-host="45f67e85606e40618880919fc1ea7708" User-Agent: slrn/1.0.3 (Linux) Cancel-Lock: sha1:VCfHFyM6TlX+QcK79Zv1HGSq5PY= sha256:PVW95TkAcI8jZ+AuP+2yRSFW/kNRdeSIjv22iZLoDlU= sha1:yTFuJqiz0yg0ZHSZTHe1JwPtyzw= sha256:FXHXdPlziOAipBHzsgCdrktL3aQIessQtCt99fSPHqs=