🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #555

Re: two's complement and Flags (Re: arithmetic and endian history)

#555
From: John Levine
Date: Fri, 06 Nov 2026 19:22
46 lines
3137 bytes
It appears that Anton Ertl <anton@mips.complang.tuwien.ac.at> said:
>John Levine <johnl@taugh.com> writes:
>[PDP-4]
>>They
>>added two's complement arithmetic because the users wanted to do
>>multiple precision and floating point arithmetic with more than 18
>>bits which is a lot easier to do in two's complement. It also added a
>>"link" bit to hold the carry out of the accumulator, and instructions
>>to test it so you could do something like this for a two word addition
>>
>>  CLA A / low part
>>  TAD B / carry is in the link bit
>>  DAC C
>>
>>  CLA A+1 / high part
>>  SZL / skip on zero link
>>   IAC / add 1 to AC if there was a carry
>>  TAD B+1
>>  DAC C+1
>
>That's good enough for double-precision integer arithmetic, but for
>multiple-precision integers, an add with carry-in and carry-out is
>needed.  The first sequence only does carry-out, the second only
>carry-in; the second produces a carry, but it does not reflect a
>possible carry-out of the IAC.

Keep in mind that this computer was designed in 1962, built out of
individual transistors soldered onto PC cards, and had 1K, 4K, or 8K
18 bit words of core memory. Of course more modern instruction sets are
better.

The point is that they understood that two's complement made multiple
precision arithmetic a lot easier than one's comp or sign-magnitude,
and they added a testable flag where they stored the carry.  As the
manual said about the tad instruction:

  2's complement add. The C(Y) are added to
  C(AC) in 2's complement arithmetic. If there
  is a carry out of bit 0 of the AC, the Link will
  be set to 1. This feature is useful in multiple
  precision arithmetic. 

-- 
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly
Technical Details
Message-ID: <11cl9d6$464$1@gal.iecc.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!weretis.net!feeder9.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!not-for-mail
References: <10uks4f$1dqo$1@gal.iecc.com> <6ae8eec0.35320218@news.eternal-september.org> <11cjh58$1flq$4@gal.iecc.com> <2026Nov6.072410@mips.complang.tuwien.ac.at>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!weretis.net!feeder9.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!not-for-mail
From: John Levine <johnl@taugh.com>
Newsgroups: comp.arch
Subject: Re: two's complement and Flags (Re: arithmetic and endian history)
Date: Fri, 6 Nov 2026 19:22:14 -0000 (UTC)
Organization: Taughannock Networks
Message-ID: <11cl9d6$464$1@gal.iecc.com>
References: <10uks4f$1dqo$1@gal.iecc.com> <6ae8eec0.35320218@news.eternal-september.org> <11cjh58$1flq$4@gal.iecc.com> <2026Nov6.072410@mips.complang.tuwien.ac.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 6 Nov 2026 19:22:14 -0000 (UTC)
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970";
	logging-data="4292"; mail-complaints-to="abuse@iecc.com"
In-Reply-To: <10uks4f$1dqo$1@gal.iecc.com> <6ae8eec0.35320218@news.eternal-september.org> <11cjh58$1flq$4@gal.iecc.com> <2026Nov6.072410@mips.complang.tuwien.ac.at>
Cleverness: some
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: johnl@iecc.com (John Levine)