From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21799 invoked by alias); 17 Feb 2018 00:39:03 -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: 42370 Received: (qmail 12165 invoked by uid 1010); 17 Feb 2018 00:39:03 -0000 X-Qmail-Scanner-Diagnostics: from out5-smtp.messagingengine.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(66.111.4.29):SA:0(-1.9/5.0):. Processed in 9.050282 secs); 17 Feb 2018 00:39:03 -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,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=5LxIyK 8a4cZVQwVPV67E/BJfFHFXRGPRhyYZb5oXhx8=; b=e1TARpmRp+NmINc4pwpYl/ K4o22WVLcqY03sSSHd0RmesRjffCfdlmb30wq9It2pM/hyDEThIA3Cjhlh2CgDhx kr8Cw5i5AlsI+Z2h7TmNZPbuPPxOWMTT7Qc02aQdTZwL6CfmYlXZajs0O8ZPQlxr FQSVaG7WHYF5eFoVV5U3Ru88+x1+bv7lhnULLDHe0J1uoZnqN+fl05IQfDkFfQwz ly9bmRIeTgfQAXOYw3no5O9LxiBsWDKtUIwRqOt64TMp4ONkAUFYwc8jKuuaCLXk zdbYoHRPpkZ1FhUtmkoKe/a1T3UHGQZhQ7j7VllQbSvGfrljMXwse/rcSAgs/BHQ == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=5LxIyK 8a4cZVQwVPV67E/BJfFHFXRGPRhyYZb5oXhx8=; b=DqPFQuYtnUSYwwAi4J6wVZ 8Qwqo7ig+FB90zHoOOt3of7Xd2YEZpFYQuRXPf5TWwvCsSagaZ4ok4L2/ZrjvolW AGdEOlLHmydevvfKDwo42HxET41P//hxzdy75kD94mZ1qL8rQp+yEbyiiowtMA1y V3zz56biceOihykAlHIcSt61zy+jHX2JTVQ4ft7C2OE29d3pQbjGama2Yyy1G2s/ brm4XMYJ3YuxCt0mIK41Lx5jSTba5B7AWCCzrpkWl34Q82ynUuos7siCxJhAwA5+ k6UsVKR1aurGee9SjWHOLPXhiHAc8ks2a3QYXhedZPiRYZNSIPS9CBqim4rRAHCA == X-ME-Sender: Message-Id: <1518827932.2163403.1273708688.6920FBA8@webmail.messagingengine.com> From: Daniel Shahaf To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-1b99b2df Subject: Re: inf and nan in arithmetic expansions References: <20180207223051.GA30393@chaz.gmail.com> <4253.1518045946@thecus.kiddle.eu> <1518093995.645366.1263935336.265ED7BF@webmail.messagingengine.com> <17756.1518799875@thecus.kiddle.eu> Date: Sat, 17 Feb 2018 00:38:52 +0000 In-Reply-To: <17756.1518799875@thecus.kiddle.eu> 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. > @@ -791,6 +822,21 @@ zzlex(void) > break; > /* Fall through! */ Unrelated to the patch: that comment is incorrect. > default: > + if (strcmp(ptr-1, "NaN") == 0) { > + yyval.type = MN_FLOAT; > + yyval.u.d = 0.0; > + yyval.u.d /= yyval.u.d; > + ptr += 2; > + return NUM; > + } > + else if (strcmp(ptr-1, "Inf") == 0) { > + yyval.type = MN_FLOAT; > + yyval.u.d = 0.0; > + yyval.u.d = 1.0 / yyval.u.d; > + ptr += 2; > + return NUM; > + } > + > if (idigit(*--ptr) || *ptr == '.') > return lexconstant(); > if (*ptr == '#') {