From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28809 invoked by alias); 7 Nov 2015 09:55:39 -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: 20913 Received: (qmail 25351 invoked from network); 7 Nov 2015 09:55:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern_com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=rFoUqE2XFwn1S6AyDj9/noj6xzvVcYk+KSRPvEaFVvs=; b=ZF3G5Baw6p2LCOULaW29zyiEH6RmOjiNS8beYgqO2SHKum+0Ov2wuIwdjvO0FQ4Djm u6qtJhgAHNef6HXlI3Yu+UwN49pzOXy6kQx5FY8p7RyfhH7WzOi8+PwgXMKPBBrbbG7i WejB8KHKMYcqgaNsMlS1UjQXFPLQ2Fs1SuN5XRwPlhUGoT3rLN13nMB/VNQK/iqexDSd 6TAzyTZhEiC/KwVmnI5mMcIGAtu8mQmwuatnooKvIAKK5b+NVsRlnu7jFWqtXZHnEAGj KhaQMMIekm2GyxUroGEnoyi/3lvDT8h2mfu0rYzPIDDZ1+YRRD+sTKMK5wnxVs5mI8Mk Vmsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=rFoUqE2XFwn1S6AyDj9/noj6xzvVcYk+KSRPvEaFVvs=; b=DtiWuWVDh9U5sLt06EKH1/HyHnbFpKWqHCYq7tw1syCh+RHbs9O58wRKvUWDsHFhFl glp+paLXIt3Wi7X8s34riEYq8sYkQjYoCf36MzkwVY7zuZOmlOBaI93qDsIAuMutaM7F aqce7vENaF9z05HJhXRoueyIGgonGeApcoFDQQQN0lBg9gUmyxkJfgNzEZpiFbupv1X+ Ao0spoJtLbp8sGQtrOBzIf0MnwsCvbk34Y5TsUQJzV3hUtR8Ux6U4HvEygHYraWC3FDy aNfVaT9377lSzzPq7nueJZh98CSwukoxizhEMLpngDlAPJRDe0Rn7y0SGsKLs0SasGtm hcAQ== X-Gm-Message-State: ALoCoQkR+ElxycSpci3h21wEiNlfXkf21HOoaOrKHILcYO+dHVKjLL8KYgrQ0ClBUji/rj5T/rqb X-Received: by 10.60.156.9 with SMTP id wa9mr10803634oeb.17.1446890137008; Sat, 07 Nov 2015 01:55:37 -0800 (PST) From: Bart Schaefer Message-Id: <151107015534.ZM23371@torch.brasslantern.com> Date: Sat, 7 Nov 2015 01:55:34 -0800 In-Reply-To: <563D281F.1000304@eastlink.ca> Comments: In reply to Ray Andrews "Re: two mysteries" (Nov 6, 2:22pm) References: <563A4A75.1020009@eastlink.ca> <151104123546.ZM20556@torch.brasslantern.com> <563AA51B.3040101@eastlink.ca> <151106104455.ZM22748@torch.brasslantern.com> <563D281F.1000304@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: two mysteries MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Nov 6, 2:22pm, Ray Andrews wrote: } } But what ended up happening is that the type check reported it as (can't } recall) no longer integer, and I did the check just before the fatal } division, so something had changed it previous to that. My only guess is that in some cases the assignment occurs before the declaration: torch% START_IDX=1+((idx-1)/page_hight)*page_hight torch% print ${(t)START_IDX} scalar torch% integer START_IDX zsh: division by zero torch% print ${(t)START_IDX} integer torch% The value currently in the scalar $START_IDX is evaluated when the type changes to integer, which causes the division by zero. Interestingly, bash allows integers to have non-integer values, so this is not an error there: $ foo='1/0' $ typeset -i foo $ echo $foo 1/0 $ typeset -p foo declare -i foo="1/0" $ This is because bash does all the arithmetic only at assignment time. } Didn't I read that } there's a difference between 'typeset -i' and 'integer'? Read where ...? Doc: integer [ {+|-}Hghlprtux ] [ {+|-}LRZi [ N ] ] [ NAME[=VALUE] ... ] Equivalent to typeset -i, except that options irrelevant to integers are not permitted.