From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1056 invoked from network); 28 Nov 1997 20:23:13 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 28 Nov 1997 20:23:13 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id PAA18239; Fri, 28 Nov 1997 15:13:47 -0500 (EST) Resent-Date: Fri, 28 Nov 1997 15:13:22 -0500 (EST) Sender: alainc@griffon.sanga-mtl.com Message-ID: <347F26A5.BBB84546@sangacorp.com> Date: Fri, 28 Nov 1997 15:16:37 -0500 From: Alain Caron Organization: Sanga Research Corporation X-Mailer: Mozilla 4.03 [en] (X11; U; Linux 2.1.25 i586) MIME-Version: 1.0 To: mito@aparima.com CC: zsh-users@math.gatech.edu Subject: Re: strange arithmetic References: <19971128140924.07137@retriever> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Resent-Message-ID: <"AYhVq1.0.NS4.XNoVq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1161 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Louis-David Mitterrand wrote: > (using 3.0.5) > > % i=0;while [[ $[++i] < 900 ]];do;echo $i;done > % 1 > % 2 > [...] > % 90 > > 90 ?? I asked for 900 and it stops at 90. On the other hand the > following: > > % i=0;while ! [[ $[++i] = 900 ]];do;echo $i;done > % 1 > % 2 > [...] > % 899 > > Is this normal? > > -- > > Louis-David Mitterrand > http://www.aparima.com > mito@aparima.com This is, I presume, because ">" and "=" are doing a lexicographic comparison. For a numeric comparison, use "-gt" and "-eq" operators. Alain Caron alainc@sangacorp.com