Path: utzoo!mnetor!uunet!husc6!mailrus!nrl-cmf!ames!pasteur!ucbvax!miro.Berkeley.EDU!ph From: ph@miro.Berkeley.EDU (Paul Heckbert) Newsgroups: comp.bugs.4bsd Subject: csh arithmetic bug Message-ID: <23570@ucbvax.BERKELEY.EDU> Date: 10 Apr 88 19:22:50 GMT Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: ph@miro.Berkeley.EDU (Paul Heckbert) Organization: University of California, Berkeley Lines: 16 Beware of doing arithmetic in csh, it's buggy! The command @ x = 0 - 1 + 2 sets x to -3 (should be 1) The command @ x = 0 - 1 - 2 sets x to 1 (should be -3) (same error with Sun UNIX 3.5 on Sun3 and 4.3 BSD on Vax780) csh must be parsing right-associatively by mistake! Division has a similar problem. It's hard to believe that a bug like this would persist for 8 years. Paul Heckbert, CS grad student 508-7 Evans Hall, UC Berkeley UUCP: ucbvax!miro.berkeley.edu!ph Berkeley, CA 94720 ARPA: ph@miro.berkeley.edu