Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Math expression evaluation error?
On 01/10/2015 11:14 AM, Bart Schaefer wrote:
On Jan 10, 10:48am, Ray Andrews wrote:
}
} is just to ask: What is most useful? What would produce the maximum
} utility along with the least surprise, especially for a new user? In
} which direction is 'the future'?
Call me a cynic or a curmudgeon as you prefer, but the future of new
users who would give so little thought and study to the tools they
are using as to find this a problem more than once, is to not use
shells at all.
That's quite legitimate. The 'fix' is after all very simple. You know, in
this sort of discussion pressures can build beyond what the issue
merits. 'setopt force_float' and there's nothing more to worry about.
But so long as you wish to discuss it, I'll just do what I do and advocate
for a friendlier and more intuitive shell where possible: However simple
the fix may be, it remains my view that the intuitive behavior should
be the default. It's just my paradigm. I quite understand that it will
not prevail. Not worth the price of a beer, and certainly not worth any
disturbance.
It *is* probably less than ideal that "zcalc -f" is not the default
And that's all I'm saying, (but, for "$ (( ))" too).
BTW, just Googling, I see that this issue has come up time and again.
Our original poster on this thread is not the first person to be got by
this gotcha. Why not make the issue go away, once and for all?
One could have fun with some facetious advertising:
"Try zsh, the shell where 1/2 + 1/2 = 1 !!!"
for the actual calculator utility; but pretending that $(( ... )) could
ever be described "a calculator with no surprises or gotchas" regardless
of integer arithmetic, is misleading because it isn't a calculator and
trying to think of it that way is going to cause surprises and gotchas.
Well, it could come to a question of terminology or even of hard facts. I
myself have (until this issue came up) never done anything beyond simple
integer addition and subtraction. From what I read, $ (( )) does quite
sophisticated calculations and it is ergo, ipso facto a calculator. And
I also
presume that it accesses all the power of 'zcalc' (because why
*wouldn't* it?)
However, if it does have gotchas in it (I mean beyond the current subject)
I can't say, I just presume it does what it advertises itself to do, and
my experiments with it bare that out-- and that's 'calculation' as I use
the word. But don't take my pseudo manual as anything more than a
comment please it's just what I wish was the case.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author