Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: inf and nan in arithmetic expansions
- X-seq: zsh-workers 42347
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: inf and nan in arithmetic expansions
- Date: Thu, 08 Feb 2018 12:46:35 +0000
- 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=9DFcFg RD2pczQltdrfobZb5Hbmb4ODmZJoXJSRJBYiY=; b=IPenxKncs00woaU3LLyeUT SfZNbhVg1t2ycMzF4wp2OaawSttguM+FGFu+7v9n9s0yLXTlubijfONE35d7NRZ7 zpGiFp1jubh5KoZIz39e27OZ5DWgRBLdXd5eYYSoIUbz8VNV/kLYUYJDIy7f67qg l0UPTiSbDSwF/2L/ad604LB8+wbfqfsiMqKhL6i73p4wzN1d1z2iRqtjhmicdrXM 9mBkn88OK9jDSVjA6VmrWkOKK/QwT0522Evap4/ghh05sYq6fHxJQUvaW/TnLVtx ZmAYzT+MjW9wBZP1UHGz1tCPLr3DCg6k/RmPGb5eKN0Yl2xME8IftZcwuXBQY/tA ==
- 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=fm1; bh=9DFcFg RD2pczQltdrfobZb5Hbmb4ODmZJoXJSRJBYiY=; b=nyiYMBy3B0ienKcdXIsSlJ sgP+g7Y83pNxmRBKS7xejlbSKn+4eI++jFvKrWRkQ00JwV6PscEwJSXntk0dkQ1X PpB2GWDkQrtVUW+OGq9M4/y8WriQHvQGvgTWKwvVLz62Zvp7F0QUycuiCdA7QVVc 8+Vs2zHomE65ngQ4jrVzB6XOTmN/7RY4udGYCLiyKF6Wq5NA4HhKo/yTNgUCxc3I GOVEIm795OLpCpCBzgamm46Ug2Hqk3QbFeyG0x5SRBlKdB9j3UOhftmFc97o/KVD Hg7QIEPriD01eE3X1EBU+L/fa1OTjaU4kECT8OtZ4Z9ybmnfZqtDMZyCi3CiN5Gg ==
- In-reply-to: <4253.1518045946@thecus.kiddle.eu>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180207223051.GA30393@chaz.gmail.com> <4253.1518045946@thecus.kiddle.eu>
Oliver Kiddle wrote on Thu, 08 Feb 2018 00:25 +0100:
> > 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.
Why do we generate "inf." with a period in the first place? I know of
no other tool that does this. Shouldn't we generate "inf" and "nan"
with no period?
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...
Cheers,
DAniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author