Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: inf and nan in arithmetic expansions

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...



Messages sorted by: Reverse Date, Date, Thread, Author