From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christian Schlauer Newsgroups: gmane.emacs.devel Subject: Re: Calc: `*' binds more strongly than `/' Date: Wed, 25 Apr 2007 21:56:51 +0200 Message-ID: References: <87y7kvxj6p.fsf@arcor.de> <87odlrkn74.fsf@truman.edu> <87tzvhcul9.fsf@stupidchicken.com> <863b2z2mma.fsf@blue.stonehenge.com> <55350.128.165.123.18.1176926533.squirrel@webmail.lanl.gov> <86ps5zuwmi.fsf@blue.stonehenge.com> <87ps5zi1h2.fsf@truman.edu> <462C8EA2.9090003@gnu.org> <87ejmbdr1x.fsf@truman.edu> Reply-To: cs-usenet@arcor.de NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1177531337 19130 80.91.229.12 (25 Apr 2007 20:02:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 25 Apr 2007 20:02:17 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 25 22:02:04 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Hgnf3-00077B-NF for ged-emacs-devel@m.gmane.org; Wed, 25 Apr 2007 22:00:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hgnkg-0005Ou-IC for ged-emacs-devel@m.gmane.org; Wed, 25 Apr 2007 16:06:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hgnkd-0005O3-UN for emacs-devel@gnu.org; Wed, 25 Apr 2007 16:06:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hgnkc-0005N2-Eu for emacs-devel@gnu.org; Wed, 25 Apr 2007 16:06:07 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hgnkc-0005Mz-B9 for emacs-devel@gnu.org; Wed, 25 Apr 2007 16:06:06 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Hgnew-0001Iz-VW for emacs-devel@gnu.org; Wed, 25 Apr 2007 16:00:15 -0400 Original-Received: from root by ciao.gmane.org with local (Exim 4.43) id 1Hgnek-0005Wd-9o for emacs-devel@gnu.org; Wed, 25 Apr 2007 22:00:02 +0200 Original-Received: from finn.gmane.org ([80.91.229.4]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Apr 2007 22:00:02 +0200 Original-Received: from cs-usenet by finn.gmane.org with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 Apr 2007 22:00:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 80 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: finn.gmane.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.98 (gnu/linux) X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:70127 Jay Belanger writes: > storm@cua.dk (Kim F. Storm) writes: > ... >> I seem to be the only one who have spoken in favour of the current >> precedence rule, but I'm only a casual user of calc, so my opinion >> shouldn't matter here! > > You must have missed a few messages; you are by no means the only one > in favor of the current rule. I checked the thread and Randal L. Schwartz, Daniel Brockman and Kim F. Storm backed up the current behaviour. Carsten Dominik likes the current behaviour, too. Stefan Monnier, Miles Bader, Jason Rumney and me "prefer" a change of the current behaviour. >> Besides, I usually add () to mixtures of / and * anyway (for clarity >> and/or to dictate a specific evaluation order to get maximum precision >> in the result). > > Well, I think that's the proper way of doing it; even though there are > rules for interpreting expressions like a*b/c*d, that doesn't mean > writing the expression that way is a good thing to do -- it's just bad > form. I don't think there is any difference between Calc's current > precedence rule and the more standard one for properly written > expressions. I did some more `research', and a*b/c*d is not bad form, and it is a properly written expression, see Wikipedia. Let me cite from : ,---- | 3. Evaluate multiplications and divisions, starting from the left: | | 8/2*3 = [8/2]*3 = [4*3] = 12 `---- Further down on the same page: "Since multiplication and division are of the same rank, [...]" and further on (emphasis added by me): ,---- | Warning: Multiplication and division are of *equal precedence*, and | addition and subtraction are of *equal precedence*. Using any of the | above rules in the order addition first, subtraction afterward would | give the wrong answer to | | 10 - 3 + 2 | | The correct answer is 9, which is best understood by thinking of the | problem as the sum of positive ten, negative three, and positive | two. | | It is usual, wherever you need to calculate operations of equal | precedence to work *from left to right*. The following rules of | thumb are useful: | | First: perfom any calculations inside parentheses (brackets) | | Second: Next perform all multiplication and division, working from | *left to right* | | Third: Lastly perform all addition and subtraction, working from | *left to right* `---- So besides Excel, Gnumeric, MATLAB, all pocket calculators, Wikipedia agrees with me, too. Calc's current behaviour is simply wrong, I'd say. Regards, Christian P.S.: I have not edited the Wikipedia article.