*X-seq*: zsh-workers 34205*From*: Ray Andrews <rayandrews@xxxxxxxxxxx>*To*: zsh-workers@xxxxxxx*Subject*: Re: Math expression evaluation error?*Date*: Fri, 09 Jan 2015 23:27:13 -0800*In-reply-to*: <CAH+w=7Yq40Ksd-Y49hoBLexS+-o-CQHjtZ34k5zksY+g6W0=cg@mail.gmail.com>*List-help*: <mailto:zsh-workers-help@zsh.org>*List-id*: Zsh Workers List <zsh-workers.zsh.org>*List-post*: <mailto:zsh-workers@zsh.org>*Mailing-list*: contact zsh-workers-help@xxxxxxx; run by ezmlm*References*: <54B03024.1030309@gmail.com> <20150109201552.1304eafe@ntlworld.com> <54B04ADA.9050102@gmail.com> <54B05407.7090303@eastlink.ca> <775A96D9-12A6-499B-8AAB-B2431F13701D@larryv.me> <54B069A9.2040504@eastlink.ca> <CAH+w=7Yq40Ksd-Y49hoBLexS+-o-CQHjtZ34k5zksY+g6W0=cg@mail.gmail.com>

On 01/09/2015 04:25 PM, Bart Schaefer wrote:

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.

1/2 + 1/2 = 0

**Follow-Ups**:**Re: Math expression evaluation error?***From:*Bart Schaefer

**References**:**Math expression evaluation error?***From:*jdh

**Re: Math expression evaluation error?***From:*Peter Stephenson

**Re: Math expression evaluation error?***From:*jdh

**Re: Math expression evaluation error?***From:*Ray Andrews

**Re: Math expression evaluation error?***From:*Lawrence Velázquez

**Re: Math expression evaluation error?***From:*Ray Andrews

**Re: Math expression evaluation error?***From:*Bart Schaefer

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