From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28170 invoked by alias); 19 Feb 2018 14:19:24 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42371 Received: (qmail 15621 invoked by uid 1010); 19 Feb 2018 14:19:23 -0000 X-Qmail-Scanner-Diagnostics: from mail-wr0-f169.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.128.169):SA:0(-1.9/5.0):. Processed in 1.092171 secs); 19 Feb 2018 14:19:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=V1b03i6T9Ybwox5Ri1kT+QgPUNXOvbSJt9+Vtquw46w=; b=SeV49lTJaCQypSVkSUxyiXD/o50YWR060glW65smBP4iONRLc5WTRFRifOLVbny2FM bUT6BSx4odXOwae4Nkgx5CSLvfFLV5Z7Tfa3eCSJR6Ns9yPEv3UrPIEKSryOZ+g17G7y 11ZRnNXatQ1OHZnmmMGBLAQc/d/Xc5riv4qOHv0L+tDgUoGdSqE7R5ppyFW8F3R40Qfg Zf+w0eU60Wp7hElLToRRQ3K8Uvzq4YLM/hPu8oglfDR2GHLpWl91Gix+iviP5fo0ZwzP YCTID3Q0Jkejzd8UWqJ3+EgeR4qWncKfg2RCofRpEI2mMcYkQaTj0ugWYTQHnBeMfCwL JQ7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=V1b03i6T9Ybwox5Ri1kT+QgPUNXOvbSJt9+Vtquw46w=; b=PmRlsAbE51PudNbfWoE7i+7DWT473DHaEvA+cXsxvf7+IC36ot2ogXFRS6PEyRh7pM 2IiBH0O7Ihz3+s+S9sJSUX7iqLDoXjaCPvICxgodq9/08F+j+tVG2HE7HNU6atFH77Bt btKsdu7SUVEjwFoJI1b3n8VQhltbpfBgvdy4RVTt5DUihyx7caaE0TlDHlCNGbcKuAHB zuCRf9gY8Bea+3AHEJMAkk6dl3S6tS7sNpOvnz3MFfNk4Cq2Zbia2d6NetwM/7dVX9f7 3JAsJQvpGMzQpQP+lvWGVeQnuhGiEqasCAOzehUS7EyYPoy733kB4bFDazgftlyl9POP saag== X-Gm-Message-State: APf1xPBV7fxaZ4UFFRpjYfIY46sFL2E20yNdtDdUcgNUmUCzeZv7lmW2 FkrvxiT+Yl7E61A9sSQgxkk= X-Google-Smtp-Source: AH8x224GJ7Z0D0+k2oWTYc3juoHt40hs6p1aR9JOW4at2MQwSScR5ncHTqs0+H5xaJhCavLXf/2kkQ== X-Received: by 10.223.150.41 with SMTP id b38mr13194446wra.229.1519049957708; Mon, 19 Feb 2018 06:19:17 -0800 (PST) Date: Mon, 19 Feb 2018 14:19:15 +0000 From: Stephane Chazelas To: Daniel Shahaf Cc: zsh-workers@zsh.org Subject: Re: inf and nan in arithmetic expansions Message-ID: <20180219141915.GA9833@chaz.gmail.com> Mail-Followup-To: Daniel Shahaf , zsh-workers@zsh.org References: <20180207223051.GA30393@chaz.gmail.com> <4253.1518045946@thecus.kiddle.eu> <1518093995.645366.1263935336.265ED7BF@webmail.messagingengine.com> <17756.1518799875@thecus.kiddle.eu> <1518827932.2163403.1273708688.6920FBA8@webmail.messagingengine.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1518827932.2163403.1273708688.6920FBA8@webmail.messagingengine.com> User-Agent: Mutt/1.5.24 (2015-08-30) 2018-02-17 00:38:52 +0000, Daniel Shahaf: > Oliver Kiddle wrote on Fri, 16 Feb 2018 17:51 +0100: > > > And then we could add 'inf' and 'nan' as readonly variables initialised to > > > those respective values (as Oliver also suggests in the 19597 thread). There > > > are compatibility implications for scripts that use these variable names, but > > > there is no way around them if we want to allow explicitly doing (( x = inf )) > > > in user code... > > > > I'm not sure about making them readonly simply because not doing so is > > less likely to break an existing script. > > After 42356 I am not sure whether I would prefer predefined variables > (readonly or not) or recognising 'inf' and 'nan' (putting aside the > question of case for a moment) as special constants in math contexts > as 42356 suggests. [...] A note on top of what I said earlier on that. In ksh93, from a syntax point of view, it does look a bit like ksh93 treats "inf"/"nan" (with any variation of case) like if it was a variable whose value resolved to infinity as seen when we use inf[0] (but not ${inf[0]}) in arithmetic contexts: $ ksh93 -c 'InF=(2 3); echo "$((InF[0])) $((${InF[0]}))"' inf 2 Or with: $ ksh93 -c 'inf=2; echo "$((inf = 1, inf))"' ksh93: Inf: is read only But: $ ksh93 -c 'echo "$((${Inf=2}))"' 2 $ ksh93 -c 'echo "$((${Inf=2}, Inf))"' inf That does look bad to me. I still think it doesn't make sense to treat inf/nan as variables. -- Stephane