Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!swlabs!jack
From: jack@swlabs.UUCP (Jack Bonn)
Newsgroups: comp.lang.c
Subject: Re: NULL, zero, and readable code
Message-ID: <267@swlabs.UUCP>
Date: Mon, 13-Jul-87 19:58:43 EDT
Article-I.D.: swlabs.267
Posted: Mon Jul 13 19:58:43 1987
Date-Received: Wed, 15-Jul-87 00:46:32 EDT
References: <8170@brl-adm.ARPA> <13222@topaz.rutgers.edu> <6090@brl-smoke.ARPA> <6104@brl-smoke.ARPA>
Organization: Software Labs, Ltd. Easton CT USA
Lines: 31

In article <6104@brl-smoke.ARPA>, gwyn@brl-smoke.ARPA (Doug Gwyn ) writes:
> In article <266@swlabs.UUCP> jack@swlabs.UUCP (Jack Bonn) writes:
> >I don't know whether ALL machines will leave a -0 result.  But I know
> >that the CDC 6400 (and family) did.
> 
> I wonder about this.  The CDC 1700, a 16-bit 1's complement machine using
> the same cordwood modules as the larger CDCs (which means the same bit-slice
> arithmetic modules), definitely did NOT produce -0 in normal arithmetic
> unless one introduced a -0 as an operand.  That's why I was surprised when
> I first heard people saying that -0 was a problem; I never had any trouble
> with it in two years of CDC 1700 programming.

Apparently, judging from my mail (thanks guys), I was misinformed about 
the possibility of a -0 in the CDC 6400.  One has to be careful when 
believing professors.  The interesting thing is that the instruction 
set is such that the lack of a -0 never broke anything; at least in 
the work that I did with it.  And I believe that the code would have 
been the same regardless.

I have a question though.  How do they prevent a -0 from appearing 
when you have hll code like:

a = -b;

and b is 0?  Do they generate code to subtract from 0 rather than 
just complementing the bits?  Or is that the ONLY way to do it?  It 
has been 14 years since I tried to tame that beast, and some of the 
details elude me.
-- 
Jack Bonn, <> Software Labs, Ltd, Box 451, Easton CT  06612
seismo!uunet!swlabs!jack