One's complement - was Re: Rich kids are into COBOL

Paul Koning paulkoning at comcast.net
Mon Mar 2 09:06:55 CST 2015


> On Mar 1, 2015, at 6:05 PM, Toby Thain <toby at telegraphics.com.au> wrote:
> 
> On 01/03/15 6:42 AM, Johnny Billquist wrote:
>> On 2015-03-01 06:14, Jon Elson wrote:
>>> On 02/28/2015 04:59 AM, Johnny Billquist wrote:
>>>> Not that Unix was ever written in B anyway, but I believe that B did
>>>>>> exist for the PDP-7.
>>>>> 
>>> I looked up the instruction set of the PDP-7, ghastly little machine,
>>> basically
>>> a PDP-8 extended to 18 bits. ...
>> 
>> ...
>> 
>> The ones and twos complement is the most interesting part. I suspect
>> that is because they really had decided that twos complement was the
>> future. However, the DEC 18-bit series really started with the PDP-1,
>> and all follow on machines were somewhat backwards compatible, and the
>> PDP-1 was actually a ones complement machine. The only one DEC built
>> that way. So all followon 18-bitters would have to keep the capability,
>> I guess.
> 
> Studying the CDC 6000 instruction set (through the Grishman book) really gives me the impression one's complement would be quite a headache to use correctly.

It isn’t, actually.  One’s complement has some handy properties; a number of arithmetic operations that are distinct from common logical operations in two’s complement share those operations in one’s complement.  For example, you don’t need a separate negate and complement; one operation serves both.

One critical bit of design is that the ALU needs to be a subtractor rather than an adder, otherwise you end up with -0 as the default zero result.  

It’s interesting that CDC extended the one’s complement approach to the float format, unlike the (at least nowadays) conventional approach of sign/magnitude encoding.  And with the binary point at the right rather than left of the mantissa, you end up with integers (up to 47 bits) being valid floating point encodings of that same value.

	paul




More information about the cctalk mailing list