From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7973 invoked by alias); 2 Dec 2012 23:37:29 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17447 Received: (qmail 18581 invoked from network); 2 Dec 2012 23:37:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 74.125.82.171 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-proxyuser-ip:date:from:to:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=B5Sy/4G3w3k/Ltb6YgecUDPPYQjxqrGsZqd8zWd13sg=; b=Odwp8ytLu0WYzntewEoGfzZtr9ENEHzhTbYOdEQNWwL+K2r8Zsz8HobSMNeEuBnmHt 2X2i+BNgs8BMhrFd0EWFSJcAUHGKX59nqqIwYQI5gqWHfZZ5z+pSaOsuMuAf1qJWHJHa TLoXH3NrvEkBHukgGoaN4Fb/ZcSbVBhLGquxGaC4pVoqs1+z27fsxbZixuhYAbPsPlZ8 6gh7maqERDZWcNNQ8IyLwVe1A/C50nuUsjuC93RR2PTAcQ4VPswtSrWqnQMlv4vyDeoS YsDKH6yXbQAQoHjoXfBMMyB4hNKydwytceO1JFV6Du6sVKw6TnNIAY9ZhcnpmrHdhwDT 2bgg== X-ProxyUser-IP: 82.8.55.192 Date: Sun, 2 Dec 2012 21:05:16 +0000 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: $[ 09.5 ] -- bad math expression Message-ID: <20121202210516.66e31219@pws-pc.ntlworld.com> In-Reply-To: References: X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmo2deJwvie6DLwc/VfhN/kjI+Q07P52OqiY6f4UCrX1A2MxyqEiGeTzxHQL+XYGbxF5uvj On Sun, 2 Dec 2012 23:30:34 +1300 (NZDT) Atom Smasher wrote: > with zsh 4.2.1 i get what i'd expect here: > > echo "$[ 09.5 ]" > 9.5 > > and all math operations work as expected. with zsh 4.3.10, this is broken: > > echo "$[ 09.5 ]" > zsh: bad math expression: operator expected at `.5 ' Oops. OCTAL_ZEROES looks a bit broken, too. Good job no one uses it. Index: Src/math.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/math.c,v retrieving revision 1.43 diff -p -u -r1.43 math.c --- Src/math.c 11 Sep 2012 16:02:42 -0000 1.43 +++ Src/math.c 2 Dec 2012 21:02:25 -0000 @@ -476,14 +476,11 @@ lexconstant(void) lastbase = 8; return NUM; } - nptr = ptr2; } } - else - { - while (idigit(*nptr) || *nptr == '_') - nptr++; - } + + while (idigit(*nptr) || *nptr == '_') + nptr++; if (*nptr == '.' || *nptr == 'e' || *nptr == 'E') { char *ptr2; Index: Test/C01arith.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/C01arith.ztst,v retrieving revision 1.19 diff -p -u -r1.19 C01arith.ztst --- Test/C01arith.ztst 11 Sep 2012 16:02:42 -0000 1.19 +++ Test/C01arith.ztst 2 Dec 2012 21:02:25 -0000 @@ -233,3 +233,8 @@ >6000000 >5000 >255 + + # 3/4 is a multiple of power of two so assume it's represented exactly. + print ${$(( 09.75 * 4))%%.*} +0:leading underscores +>39