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

Re: forcing float arithmetic.



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