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

Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)



On 2021-04-22 11:55:25 -0700, Bart Schaefer wrote:
> On Thu, Apr 22, 2021 at 8:31 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> >
> > On 2021-04-13 08:17:42 +0100, Stephane Chazelas wrote:
> > > I think it would be worth documenting that nan and inf are
> > > recognised in arithmetic expressions (and warn against using
> > > variables with the same name).
> >
> > IMHO, zsh should also output a warning when such variables are used.
> 
> Exactly how would that work?

When inf or nan is used in a math context and the corresponding
variable exists. For instance:

zira% echo $((inf))
Inf
zira% inf=17
zira% echo $((inf))
Inf

There should be a warning for the 3rd command.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




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