Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] POSIX arith: inf, nan should be variables
- X-seq: zsh-workers 49623
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [BUG] POSIX arith: inf, nan should be variables
- Date: Wed, 1 Dec 2021 03:31:00 +0000
- Archived-at: <https://zsh.org/workers/49623>
- In-reply-to: <53575-1638131681.212237@WIRp.dqll.oMb9>
- List-id: <zsh-workers.zsh.org>
- References: <f45c480a-a7ac-54fc-4140-665ff98f9dc6@inlv.org> <20211116125522.GA121624@zira.vinc17.org> <53575-1638131681.212237@WIRp.dqll.oMb9>
Oliver Kiddle wrote on Sun, Nov 28, 2021 at 21:34:41 +0100:
> On 16 Nov, Vincent Lefevre wrote:
> > On 2021-11-15 18:40:17 +0100, Martijn Dekker wrote:
> > > $ zsh --emulate sh -c 'inf=1; nan=2; echo $((inf)) $((nan))'
> > > Inf NaN
> > >
> > > Expected: 1 2
> >
> > FYI, this had already been discussed in April in this subthread:
>
> And it'll probably come up again if we don't do anything. Unless anyone
> has better ideas, I'm inclined to go with the following variant of
> Martijn's patch.
Maybe add a test based on the above code snippet?
Cheers,
Daniel
>
> diff --git a/Src/math.c b/Src/math.c
> index 4f24361a4..777ad9c31 100644
> --- a/Src/math.c
> +++ b/Src/math.c
> @@ -863,7 +863,7 @@ zzlex(void)
>
> p = ptr;
> ptr = ie;
> - if (ie - p == 3) {
> + if (ie - p == 3 && !EMULATION(EMULATE_SH)) {
> if ((p[0] == 'N' || p[0] == 'n') &&
> (p[1] == 'A' || p[1] == 'a') &&
> (p[2] == 'N' || p[2] == 'n')) {
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author