From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11321 invoked by alias); 9 Jan 2015 22:19:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34192 Received: (qmail 8950 invoked from network); 9 Jan 2015 22:19:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Authority-Analysis: v=2.1 cv=X+5rdgje c=1 sm=1 tr=0 a=U8x73H08pUQ9rBATJ7Nnpg==:117 a=U8x73H08pUQ9rBATJ7Nnpg==:17 a=Hpgzp-inWqAA:10 a=N659UExz7-8A:10 a=v0MfnQQI6iIKQXMpTwsA:9 a=pILNOxqGKmIA:10 Message-id: <54B05407.7090303@eastlink.ca> Date: Fri, 09 Jan 2015 14:19:51 -0800 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.3.0 MIME-version: 1.0 To: zsh-workers@zsh.org Subject: Re: Math expression evaluation error? References: <54B03024.1030309@gmail.com> <20150109201552.1304eafe@ntlworld.com> <54B04ADA.9050102@gmail.com> In-reply-to: <54B04ADA.9050102@gmail.com> Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit 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?