From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1806 invoked by alias); 8 Feb 2018 07:32: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: 42345 Received: (qmail 26989 invoked by uid 1010); 8 Feb 2018 07:32:03 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net 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(205.235.26.22):SA:0(-1.4/5.0):. Processed in 1.898474 secs); 08 Feb 2018 07:32: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.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_PASS,T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=zcVh=FC=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1518075113; bh=LNMx6UkJDX79wLSqLMfmL9IUdlDBv1F5qb018qCL7XA=; h=From:References:To:Subject:Date:From:Subject; b=Rnijqjctkpz7hkt6INhLOkPCGixAfwe0M6WygHnL1XuMpRDScDWyFmhfZQL/GDLtTBxlQDX+sDafs2Izu8TijiLLJeqCsrXcqDlo4+j9DlfzY59g45gy8VSjLwO5pPF5LB98+qECd4hSDK+PFahh+CL+lzKUr17goe/CW77/r7WbxN6lwnlD2P3fWWb1073Jex9BckxN2FRThqPQ7MIBsfog8ocxxOqfX7M2a+mWVAVfNJybeozL7iqH+SOl1ecARZ7dyl9uq3s8Z7+MVOm6Jj8aiNXGcvVMQZH+yjkA+cPksL39L08/NnQNuSvvTGjVdpPTu8KcvFmakuzQegPbxw== X-YMail-OSG: CD7EjmoVM1nCeAyOCGhePOzvivM0gla2NcQAmVOPCO2s6bMK7rWruggg6ZfStXJ nTQzkAtgmxj55zjUvCyTe3MIitXqLG_QTdac7BY0lj0r18XQz.Udblh_rXU.YWYDxA9XF48SELJ2 exZacKytk4S5fpYI1nflFmhOWHwfeEXfpxaldUqn.OD1ih5o4VmrdELzvWfuwBz_ik4wV_UqqJ8x cnUBr4_PI5yI.EY7trwZ171CxaVuMWZTCnt020pILJVYzoPCwmkzqnvG5qfVZ6vR8aSHi24e6BOw 1SzQFi39UBF5e1O_abalF4AOpKNT2e_T0XW3djiLu6k1Y0v58usg3jATvUTKCqvK0PPOV.v1U3at R.x6zDGQpeEr9IIHLJQyAtnqTa4D4C07Cj3pw25Qi9NnBDueWzYkvfSPppLeYQeDYLu_U7yj_I1R JO3npmzrb_SX9tn7birr2HHmMkdLwbmf_kE.V_NJcVhS86PNSgr.v2hCEEHcPBELSY3IHtm16cPb E2M_cLjgXfw-- In-reply-to: <20180207223051.GA30393@chaz.gmail.com> From: Oliver Kiddle References: <20180207223051.GA30393@chaz.gmail.com> To: Zsh hackers list Subject: Re: inf and nan in arithmetic expansions MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4252.1518045946.1@thecus.kiddle.eu> Date: Thu, 08 Feb 2018 00:25:46 +0100 Message-ID: <4253.1518045946@thecus.kiddle.eu> Stephane Chazelas wrote: > > neither "inf." nor "inf" are understood in arithmetic > expressions (and for "inf.", nor by other tools like awk, or > even the builtin printf): > It should be safe to change zsh so that inf. (and Inf. INF. NAN. > nan., maybe also Infinity.) are recognised in arithmetic > expression, as it's currently invalid, but that leaves the > problem of "inf." not being recognised by other tools > (awk/printf). There was actually a patch posted back in workers/19597 to do this. I don't know why it never got integrated other than that a certain amount of integration work was perhaps required. It might be possible to forward port that work from 4.1.1 to the current release. Would that be welcomed or was the original patch rejected for good reasons? Any idea of where we might crib some decent test cases for IEEE 754 arithmetic from? > The printf builtin understands the C99 hex with binary > exponent on input (where strtod supports them), but not on > output (%a, %A) and not in arithmetic expressions > > $ printf "%g\n" 0x1p4 > 16 > $ printf "%a\n" 16 > printf: %a: invalid directive This was down to %a not having been portable to all systems in wide use at the time zsh's printf was written: we rely on the underlying C library printf. Adding an autoconf test would have been a lot more work than the code change to support it. From a quick check of man pages, this is perhaps not a problem anymore. Could we add it today without bothering with autoconf magic? Oliver