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

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



On Sun, Apr 11, 2021 at 12:32 PM Stephane Chazelas
<stephane@xxxxxxxxxxxx> wrote:
>
> $ zsh --emulate sh -c 'inf=42; echo $((inf))'
> Inf
>
> (POSIX requires 42 there).

Is that because "Inf" is case-sensitive, or because POSIX requires
evaluating the variable?  E.g. what does

sh -c 'Inf=42; echo $((Inf))'

yield in POSIX?  What about

sh -c 'unset Inf; echo $((Inf))'
sh -c 'unset inf; echo $((inf))'

??  I don't have a POSIX shell to test with, it seems.  Ksh "Version A
2020.0.0" responds the same as zsh, and bash "5.0.17(1)-release"
doesn't seem to have Inf at all (and gives a syntax error on
floating-point arithmetic?).




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