[Top][All Lists]
[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: |
Wed, 25 Apr 2007 15:54:36 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.98 (gnu/linux) |
Christian Schlauer <address@hidden> writes:
> Jay Belanger <address@hidden> writes:
...
>> 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
> <http://en.wikipedia.org/wiki/Order_of_operations#Examples_from_arithmetic>:
As I said, there are rules for interpreting the above expressions.
I also said that avoiding the parentheses is bad form; note that the
wikipedia article also says:
Proper use of parentheses and other grouping symbols
When restricted to using a straight text editor, parentheses (or
more generally "grouping symbols") must be used generously to make
up for the lack of graphics, like square root symbols. Here are some
rules for doing so:
1) Whenever there is a fraction formed with a slash, put the
numerator (the number on top of the fraction) in one set of
parentheses, and the denominator (the number on the bottom of the
fraction) in another set of parentheses. This is not required for
fractions formed with underlines:
y = (x+1)/(x+2)
...
5) An exception to the rules requiring parentheses applies when only
one character is present. While correct either way, it is more
readable if parentheses around a single character are omitted:
y = (3)/(x) or y = 3/x
y = (3)/(2x) or y = 3/(2x)
> So besides Excel, Gnumeric, MATLAB, all pocket calculators, Wikipedia
> agrees with me, too.
Well, wikipedia also says
Calculators
Different calculators follow different orders of operations.
and gives several examples.
The reason for Calc's current behavior is because Dave Gillespie,
Calc's author, thought of "a b / c d" as representing
a b
---
c d
To have it represent "a(b/c)d", the parentheses can (and, according to
wikipedia, should be) put in. For those that really don't like
parentheses, an option to allow the user to decide for themselves the
relative precedence of * and / in Calc will be added, of course.
Jay
- Re: Calc: `*' binds more strongly than `/', (continued)
- Re: Calc: `*' binds more strongly than `/', Christian Schlauer, 2007/04/22
- Re: Calc: `*' binds more strongly than `/', Jay Belanger, 2007/04/22
- Re: Calc: `*' binds more strongly than `/', Jason Rumney, 2007/04/23
- Re: Calc: `*' binds more strongly than `/', Kim F. Storm, 2007/04/23
- Re: Calc: `*' binds more strongly than `/', Jay Belanger, 2007/04/23
- Re: Calc: `*' binds more strongly than `/', Christian Schlauer, 2007/04/25
- Re: Calc: `*' binds more strongly than `/',
Jay Belanger <=
- Re: Calc: `*' binds more strongly than `/', Stefan Monnier, 2007/04/25
- Re: Calc: `*' binds more strongly than `/', Jay Belanger, 2007/04/26
- Re: Calc: `*' binds more strongly than `/', Stefan Monnier, 2007/04/26
- Re: Calc: `*' binds more strongly than `/', Christian Schlauer, 2007/04/26
- Re: Calc: `*' binds more strongly than `/', Davis Herring, 2007/04/26
- Re: Calc: `*' binds more strongly than `/', Stefan Monnier, 2007/04/26
- Re: Calc: `*' binds more strongly than `/', Luc Teirlinck, 2007/04/26
- Re: Calc: `*' binds more strongly than `/', Christian Schlauer, 2007/04/26
- Re: Calc: `*' binds more strongly than `/', Luc Teirlinck, 2007/04/26
- Re: Calc: `*' binds more strongly than `/', Christian Schlauer, 2007/04/26