From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20129 invoked by alias); 12 Jan 2015 09:17:40 -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: 34250 Received: (qmail 3715 invoked from network); 12 Jan 2015 09:17:39 -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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Date: Mon, 12 Jan 2015 10:17:37 +0100 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: Re: Math expression evaluation error? Message-ID: <20150112091737.GB27773@xvii.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org References: <775A96D9-12A6-499B-8AAB-B2431F13701D@larryv.me> <54B069A9.2040504@eastlink.ca> <54B0D451.1000502@eastlink.ca> <150110085320.ZM28012@torch.brasslantern.com> <54B173ED.20301@eastlink.ca> <150110111445.ZM21328@torch.brasslantern.com> <54B1A5EC.2080202@eastlink.ca> <150110175103.ZM21764@torch.brasslantern.com> <54B205B8.4080208@eastlink.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <54B205B8.4080208@eastlink.ca> X-Mailer-Info: http://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.23-6391-vl-r75100 (2015-01-06) On 2015-01-10 21:10:16 -0800, Ray Andrews wrote: > Sure. That's the best argument for leaving it alone and of course it is > perfectly sound. I'd go the other way, liking friendliness more, but > I respect your decision. And I could be quite wrong about 1/2 + 1/2 = 0, > strange as it looks to me, rounding down could be vital to some code > somewhere. It's only a notation problem. Unfortunately / was chosen (historically, not by zsh) as the symbol for integer division. The shell expression 1/2 + 1/2 just means: integer_div(1,2) + integer_div(1,2) where integer_div is the integer division function, which gives 0. This is perfectly correct math. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)