emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: In CVS Emacs, calc-eval gives multiplication higher precidence than


From: Randal L. Schwartz
Subject: Re: In CVS Emacs, calc-eval gives multiplication higher precidence than division
Date: Sun, 07 Sep 2008 18:13:32 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (berkeley-unix)

>>>>> "Lennart" == Lennart Borgman (gmail) <address@hidden> writes:

Lennart> More seriously: Where do you get those rules from? The notation

Lennart>   a b / c d

Lennart> does not look like a standard math notation.

If a is 2, and c is 5, you're actually telling me that *you*
would parse:

      2 b / 5 d

as ((2 * b) / 5) * d ?

That's crazy.

That's (2b)/(5d), according to any math teacher I knew from school.

That's the only sane parsing of that.

Now, replace 2 with "a" and 5 with "c", and you get:

  ab/cd

which is (ab)/(cd).

That's what I mean. This is the *mathematical* evaluation.  In this case,
division *is* lower precedence than multiplication.

Anyway, maybe you've never seen expressions like 2a/5d before.  I dealt with
them in my algebra class, but perhaps that was before you were born, and
before computers came into usage in high schools.  I suppose the rules changed
once we started teaching * and / as same precedence in computer science, which
then leaked over into math notation as well.

I'm probably not going to convince you of anything here, but I did want to
come up with a better example, now that I'm going through the calc manual
again.  And then, it made perfect sense, as it still does.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<address@hidden> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion





reply via email to

[Prev in Thread] Current Thread [Next in Thread]