emacs-devel
[Top][All Lists]
Advanced

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

Re: Calc: `*' binds more strongly than `/'


From: Jay Belanger
Subject: Re: Calc: `*' binds more strongly than `/'
Date: Tue, 17 Apr 2007 13:54:34 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux)

address@hidden (Randal L. Schwartz) writes:

>>>>>> "Stefan" == Stefan Monnier <address@hidden> writes:
> Stefan> After Emacs-22, we should probably just change the precedence to be 
> the
> Stefan> "normal" one.
>
> No, not normal for mathemeticians (and me on a bad day), who expect A*B/C*D to
> be the same as (A*B)/(C*D).

Really?  If I saw A*B/C*D, the main thing I'd be thinking is "Gee, I
wish parentheses were put in."  

> I suggest it not be changed.  It will break old code (Calc has been around for
> almost two decades), it's a minor thing, and people have eventually stumbled
> on it, and it's well (over?) documented.

Is there any old code that relies on the current order of operations?

I just tried out 2*3/4*5 on a TI-86 and HP48; they both gave me 7.5.
I don't have a TI myself, so I used a student's.  There were several
grad students around, most of whom will eventually teach high school.
When I asked them what "2*3/4*5" should mean, I had a hard time getting an
answer.  They kept saying "You're missing parentheses" or "what are
you trying to write?"; when I finally asked how they would interpret
it if they saw it on a paper, one student said "I'd write 'minus one,
bad notation'".  I think she's right.
Traditionally, I think * and / are supposed to have identical
precedence, and when mixed should be performed left to right.  But
I think writing A*B/C*D when you mean A*(B/C)*D is poor notation.  I
also think writing A*B/C*D when you mean (A*B)/(C*D) is poor notation,
but a couple of people have said that it's a convenient shortcut that
saves the trouble of typing in parentheses.  So perhaps there's
something to be said for the current behavior.

Jay




reply via email to

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