Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Math expression evaluation error?
On Fri, Jan 9, 2015 at 3:52 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> 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.
3/8 is not a fraction. Yes, in a text paragraph like this one I might
write 3/8 as a fraction because I can't write a superscript three over
a subscript eight, but in an arithmetic expression 0.375 is a fraction
and 3/8 is "integer 3 divided by integer 8", and the definition of
"divided by" includes "if both numerator and denominator are integers,
then the result must also be an integer". As has been mentioned, this
is the way a LOT of programming languages work.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author