Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Math expression evaluation error?
On 01/09/2015 01:40 PM, jdh wrote:
Thanks for the detailed explanation. I suggest that the an
additional line be added to the manual, which would say something like:
{
$ echo $(( 6+3/8. + 10 + 5/8 ))
$ echo $(( 6+3/8 + 10 + 5/8. ))
$ echo $(( 6+3/8. + 10 + 5/8. ))
$ echo $(( 6+3/8 + 10 + 5/8 ))
}
16.375
16.625
17.
16 << really?
$ setopt force_float
{
$ echo $(( 6+3/8. + 10 + 5/8 ))
$ echo $(( 6+3/8 + 10 + 5/8. ))
$ echo $(( 6+3/8. + 10 + 5/8. ))
$ echo $(( 6+3/8 + 10 + 5/8 ))
}
17.
17.
17.
17.
Thanks for the heads up, I now know not to trust zsh math without the
option.
I wonder tho why anyone would ever want the first set of results.
Who/why/when
do we want bad math? Wouldn't we prefer accurate results as the default with
the option to have broken math for people who like broken math? Why not have
it work properly and that's that--nothing to explain, it just works as
you'd expect it to work?
6 + 3/8 + 10 + 5/8 ...
what sane calculator is going to give me '16' for that?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author