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

Re: Math expression evaluation error?



On 01/09/2015 03:06 PM, Lawrence Velázquez wrote:
On Jan 9, 2015, at 5:19 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:

I wonder tho why anyone would ever want the first set of results. Who/why/when
do we want bad math?
Mathematics restricted to the set of integers is not "bad math", no matter how much you assert that it is.

I assert nothing, I ask a question. I just 'automatically' presume that zsh calculations will be done like any normal calculator would do them.

$ echo $(( 3/8 + 5/8 ))
0

.. if that's what people want, then that's what they'll get, it just seems
a bit strange to me. I'd say that the very fact that I enter a fraction tells
the shell that I'm expecting a real number answer.  Or maybe not.

But that's just my take on it, I'm not saying.  It seems to me that if the
shell accepts the fractions then it should return the correct answer.  I'd
make integer math  the option and have accurate results as the default
but that's just me.




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