[net.unix-wizards] minus zero strikes again

henry@utzoo.UUCP (Henry Spencer) (07/24/84)

Has anybody got yacc up on a machine which has distinct 0 and -0?
If so, did you have any fun?  I just noticed that yacc actually
generates code using -0 as a subscript.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (07/26/84)

I don't think "-0" at the source code level will cause any
problem.  I used to use ones' complement machines and the
only way you could get a -0 out of an arithmetic expression
was by having ones for an operand.  In particular, negating
0 would give (normal) 0.

louie@cvl.UUCP (07/26/84)

<for all you do, this one's for you>

We run UNIX on our Sperry 1100/80 system from time to time, and it has
one's compliment hardware.  The -0 subscript shouldn't be a problem, 
because the hardware treats -0 the same as +0 as far as arithmetic
operations are concerned.

Here's for UNIX on the big guys....
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Louis A. Mamakos - Computer Science Center (Systems Staff) - Univ. of Maryland
Internet: louie@cvl.ARPA     uucp: ...!{seismo,ihnp4,allegra}!rlgvax!cvl!louie

Why would you even think that the opinions expressed are those of my employer?

gwyn@BRL-VLD.ARPA (07/28/84)

From:      Doug Gwyn (VLD/VMB) <gwyn@BRL-VLD.ARPA>

Upon further reflection, I realize that a C implementer on
a 1's-complemenet machine may have made a mistake and
implemented negation (unary minus) by ones'-complementing
the (integer) value instead of correctly subtracting it
from zero, so Henry's query amounts to asking whether any
C implementer on a 1's-complement machine was so foolish.