zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: [BUG] POSIX arith: inf, nan should be variables
Date: Wed, 1 Dec 2021 03:31:00 +0000	[thread overview]
Message-ID: <20211201033100.GC10648@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <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')) {
> 


  reply	other threads:[~2021-12-01  3:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 17:40 Martijn Dekker
2021-11-16  9:06 ` Oliver Kiddle
2021-11-16 12:55 ` Vincent Lefevre
2021-11-28 20:34   ` Oliver Kiddle
2021-12-01  3:31     ` Daniel Shahaf [this message]
2021-12-01  3:37       ` Bart Schaefer
2021-12-01  4:27         ` Writing XFail tests (was: Re: [BUG] POSIX arith: inf, nan should be variables) Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211201033100.GC10648@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).