From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel,gmane.emacs.bugs Subject: Re: In CVS Emacs, calc-eval gives multiplication higher precidence than division Date: Sun, 07 Sep 2008 17:15:38 -0400 Message-ID: References: <878wu3j4k2.fsf@gmail.com> <873akbitie.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1220822153 32289 80.91.229.12 (7 Sep 2008 21:15:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Sep 2008 21:15:53 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org, Francis Litterio , emacs-devel@gnu.org To: jay.p.belanger@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 07 23:16:48 2008 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 1KcRcm-0005py-CW for ged-emacs-devel@m.gmane.org; Sun, 07 Sep 2008 23:16:48 +0200 Original-Received: from localhost ([127.0.0.1]:42297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KcRbm-0006xw-8m for ged-emacs-devel@m.gmane.org; Sun, 07 Sep 2008 17:15:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KcRbi-0006xG-Is for emacs-devel@gnu.org; Sun, 07 Sep 2008 17:15:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KcRbi-0006wq-8a for emacs-devel@gnu.org; Sun, 07 Sep 2008 17:15:42 -0400 Original-Received: from [199.232.76.173] (port=59565 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KcRbg-0006sw-8G; Sun, 07 Sep 2008 17:15:40 -0400 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:24896 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KcRbf-0008E9-W0; Sun, 07 Sep 2008 17:15:40 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiQFAGjhw0hFxIqP/2dsb2JhbACBZbAVgWaBBw X-IronPort-AV: E=Sophos;i="4.32,353,1217822400"; d="scan'208";a="26488125" Original-Received: from 69-196-138-143.dsl.teksavvy.com (HELO ceviche.home) ([69.196.138.143]) by ironport2-out.teksavvy.com with ESMTP; 07 Sep 2008 17:15:39 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 94C4FB4062; Sun, 7 Sep 2008 17:15:38 -0400 (EDT) In-Reply-To: <873akbitie.fsf@gmail.com> (Jay Belanger's message of "Sun, 07 Sep 2008 15:35:37 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. 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:103655 gmane.emacs.bugs:20325 Archived-At: >>> That's not a bug. While many systems give division a higher precendence >>> than multiplication, that isn't a universal rule. >> Actually, I don't know of any system that gives higher precedence to >> division. > According to Wikipedia: > An expression like 1/2x is interpreted as 1/(2x) by TI-82, but as > (1/2)x by TI-83. While the first interpretation may be expected by > some users, only the latter is in agreement with the standard rules > stated above. That could be due to a higher precedence, but could also be due to an equal precedence together with left-associativity. Given that (a*b)/c is often mathematically equal to a*(b/c), the difference is generally hard to see, unless rounding comes into play. All textbooks and language references I know use the "equal precedence and left associativity" rule rather than giving higher precedence to the division. >> The general rule that (AFAIK) all programming languages >> follow (other than those that don't use infix-with-precedence, such as >> Lisp and Smalltalk) is that * and / have the same precedence (and are >> left associative). > That behavior is available, but you have to ask for it by setting > `calc-multiplication-has-precedence' to nil. I know. But we're talking about the default behavior. Stefan