From: Stefan Monnier <monnier@iro.umontreal.ca>
To: jay.p.belanger@gmail.com
Cc: bug-gnu-emacs@gnu.org, Francis Litterio <flitterio@gmail.com>,
emacs-devel@gnu.org
Subject: Re: In CVS Emacs, calc-eval gives multiplication higher precidence than division
Date: Sun, 07 Sep 2008 17:15:38 -0400 [thread overview]
Message-ID: <jwvtzcry850.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <873akbitie.fsf@gmail.com> (Jay Belanger's message of "Sun, 07 Sep 2008 15:35:37 -0500")
>>> 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
next prev parent reply other threads:[~2008-09-07 21:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-07 16:06 In CVS Emacs, calc-eval gives multiplication higher precidence than division Francis Litterio
2008-09-07 16:37 ` Jay Belanger
2008-09-07 18:15 ` Francis Litterio
2008-09-07 19:46 ` Stefan Monnier
2008-09-07 20:19 ` bug#920: " Lennart Borgman (gmail)
2008-09-07 20:32 ` Randal L. Schwartz
2008-09-08 10:30 ` Carsten Dominik
2008-09-08 11:01 ` Lennart Borgman
2008-09-08 20:33 ` Carsten Dominik
2008-09-08 20:39 ` Lennart Borgman (gmail)
2008-09-08 20:43 ` Randal L. Schwartz
2008-09-08 20:53 ` bug#914: " Lennart Borgman (gmail)
2008-09-08 21:42 ` Stefan Monnier
2008-09-09 8:11 ` Richard M. Stallman
2008-09-09 13:26 ` Stefan Monnier
2008-09-08 13:01 ` Stefan Monnier
2008-09-07 20:35 ` Jay Belanger
2008-09-07 21:15 ` Stefan Monnier [this message]
2008-09-07 21:19 ` Lennart Borgman (gmail)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvtzcry850.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=bug-gnu-emacs@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=flitterio@gmail.com \
--cc=jay.p.belanger@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).