Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] POSIX arith: inf, nan should be variables
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.
Oliver
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