From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24649 invoked by alias); 9 Jan 2015 19:47:02 -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: 34187 Received: (qmail 5685 invoked from network); 9 Jan 2015 19:46:51 -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.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=smhbVACxnfG2jXUnSmepG65TCYllB5FfaVZ5PC1qSho=; b=WhHky05dTSgHzHJ+0ALQA1mAXQUSmB96KY7qEfmCHcxLWLL2e7z+ltgE7M4N2IwYwi uMW1hZ7s0tSELnXrQ2qS3XXwFHF3JIF+MY9/jdxzQUE6Jeo7tt4ZsGu+aems/Er9gpc1 S2vHlIxd5KVd1rdJGBPIFdadvB5NpYKl5LE/6AX3lBgbLN3RYlO5YmuM1vwg7RDbvR+P KEyuTqEgRc1JRLcXvaCWg/4mvZ5Ndo3UHkqZTj/wU4XkY0TV2izK8NXSSxO1w0IYy0B5 /hwyPBXQuT5b7AA7TQK0BtCO2F7SAXfdItsNKhIa3HV6xhjF3LPVUIgfbS4bytvbLzXH TVng== X-Received: by 10.224.88.129 with SMTP id a1mr8071575qam.92.1420832806337; Fri, 09 Jan 2015 11:46:46 -0800 (PST) Message-ID: <54B03024.1030309@gmail.com> Date: Fri, 09 Jan 2015 11:46:44 -0800 From: jdh User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: zsh-workers@zsh.org Subject: Math expression evaluation error? Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit I believe I read that math expression evaluation will convert all calculations in an expression if "any" value in that expression is a real value. That is not true if the word "any" is true or a bug has crawled into the numeric expression evaluator. Or I read wrong.. Example on my system, zsh 5.0.7 (i686-pc-linux-gnu), I get the following results for the shown example: $ echo $(( 6+3/8. + 10 + 5/8. )) $(( 6+3/8 + 10 + 5/8. )) 17. 16.625 In the above case only the second term which contains a real number is evaluated as real , the previous term is taken as integer and decimal values are truncated (non-existent. This same behavior is demonstrated in zcalc. Probably uses the same logic. Though I understand why this happens (or think I do). It could cause someone a major mistake if they are unaware of this and rely on the outcome. Regards Darel