Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zmathfunc: min, max, sum throw error if result equals 0
- X-seq: zsh-workers 48603
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: zmathfunc: min, max, sum throw error if result equals 0
- Date: Fri, 16 Apr 2021 11:47:01 -0700
- Archived-at: <https://zsh.org/workers/48603>
- In-reply-to: <20210416182604.GB15670@tarpaulin.shahaf.local2>
- List-id: <zsh-workers.zsh.org>
- References: <m2pn0aj4y2.fsf@zaclys.net> <20210307171712.GA9936@tarpaulin.shahaf.local2> <CAH+w=7bPz5u9-mQPbmPmbo=8Cz8em7JmbSn-sp8eZzuvFW3mnQ@mail.gmail.com> <ee7c107d-8bfb-4063-85e8-a7638ae0f951@www.fastmail.com> <CAH+w=7ZFbOJc16r6JX4Lr6uPdVRji_=RmY3WZVBK9GtXzxjPmA@mail.gmail.com> <20210416182604.GB15670@tarpaulin.shahaf.local2>
On Fri, Apr 16, 2021 at 11:26 AM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> When «$foo» appears inside «$((…))», it's expanded as a string that's
> then parsed as math. The result of «$((…))» is then assigned to the
> $result, which is eventually used as «(( result ))», where — because
> ${(t)result} is non-integer scalar — there will be another
> string-to-integer conversion.
Yes, there's another string-to-integer conversion, but I haven't
figured out how «result=$((...))» can possibly assign any string that
is not already a plain number, so the string-to-integer conversion is
free of meaningful side-effects. Have I missed something?
- References:
- zmathfunc: min, max, sum throw error if result equals 0
- Re: zmathfunc: min, max, sum throw error if result equals 0
- Re: zmathfunc: min, max, sum throw error if result equals 0
- Re: zmathfunc: min, max, sum throw error if result equals 0
- Re: zmathfunc: min, max, sum throw error if result equals 0
- Re: zmathfunc: min, max, sum throw error if result equals 0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author