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

Re: forcing float arithmetic.



On Wed, Mar 24, 2021 at 10:51 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
On 2021-03-24 10:56 a.m., Bart Schaefer wrote:
> On Wed, Mar 24, 2021 at 10:20 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>> Why are answers dumbed down like that?
> Every subexpression is considered independently, so float conversion
> doesn't take place until the assignment is evaluated.  The type of the
> lvalue does not propagate across every rvalue.
>
So it's procedural rather than deliberate/designed.  It's not hard to
cope with
still I'd vote to correct it -- one of those things where a look ahead
could
sorta say that if the lvalue is float, then all subsequent arithmetic
will be
float.  Or not worth the trouble, it's easy enough to work around.

The behavior of zsh in this regard is consistent with C and all languages inspired by it (C++, Java, C# and many, many others). This is really working as intended.

Roman. 


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