Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: forcing float arithmetic.
- X-seq: zsh-users 26597
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: forcing float arithmetic.
- Date: Wed, 24 Mar 2021 18:45:03 -0700
- Archived-at: <https://zsh.org/users/26597>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2021-03/0421525d-8304-6142-04bd-4f564ca043c0%40eastlink.ca>
- In-reply-to: <20210325013641.GE18178@tarpaulin.shahaf.local2>
- List-id: <zsh-users.zsh.org>
- References: <f09863a2-0af9-dbff-08b9-6f595cd7e164@eastlink.ca> <CAH+w=7YJSqb+twS1X60LoJgVD95hAnJK3AAL6cA9tcafH2gqUg@mail.gmail.com> <aa6c84af-5a8c-e52a-ccb3-6a666ca2553c@eastlink.ca> <CAN=4vMq_i_FDqLbnVtZdbPEb3M58qoDdFzvf8mpQJQomtZLjHQ@mail.gmail.com> <CAH+w=7bOsdz17cfXTbNbwYXTJW_M9r67BnqVbNqkATZcU31=eQ@mail.gmail.com> <22260ea8-adec-6e16-9250-c2c2ab31fcba@eastlink.ca> <20210325013641.GE18178@tarpaulin.shahaf.local2>
On 2021-03-24 6:36 p.m., Daniel Shahaf wrote:
The «/» operator is defined to perform integer division (discarding the
remainder) when both of its arguments are integers, and floating-point
division otherwise.
Sounds pretty well written in stone. One of those things that goes back
from before the flood.
Python 3's division operator always returns floats.
I'd think of it as polite. Just now I'm doing this:
(( divided = sum * 1.0 / level ))
... and it really does seem belabored.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author