From: Christian Schlauer <cs-muelleimer-rubbish.bin@arcor.de>
To: emacs-devel@gnu.org
Subject: Re: Calc: `*' binds more strongly than `/'
Date: Wed, 18 Apr 2007 23:55:14 +0200 [thread overview]
Message-ID: <873b2xz6t9.fsf@totally-fudged-out-message-id> (raw)
In-Reply-To: 87abx6u905.fsf@truman.edu
Hello Jay and others,
thanks for discussing this.
Jay Belanger <belanger@truman.edu> writes:
[...]
> Really? If I saw A*B/C*D, the main thing I'd be thinking is "Gee, I
> wish parentheses were put in."
You write `saw' here, I'll come back to that later...
[...]
> I just tried out 2*3/4*5 on a TI-86 and HP48; they both gave me 7.5.
So does my Casio fx-115, and so did my previous Casio bought around
1990.
> 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?"
I think you found a very good example: it's about what one /writes/
and /sees/ on paper and, on the other hand, what one /types/ on a
pocket calculator (or in a spreadsheet). Writing 2*3/4*5 might be
unclear when written on paper, but that is exactly what I'd _type_ in
the calculator when I write/see on paper
2 * 3
----- * 5
4
and when I write on paper
2 * 3
-----
4 * 5
I _know_ I have to enter it as 2*3/(4*5), because my Casio and your HP
and the TIs (and OpenOffice.org's spreadsheet...) evaluate from left
to right. M-x quick-calc is made for such small calculations, but »M-x
quick-calc RET 2*3/4*5 RET« gives
Result: 2 3 / 4 5 => 0.3
which, interestingly, skips the `*' and thus looks exactly like what
Stefan called the `juxtaposition notation':
,----
| Your point is valid when you use the juxtaposition notation rather
| than *: A B / C D is indeed (A*B)/(C*D).
`----
So does quick-calc try to give a hint here to the user what it has
done by omitting the `*'? I'm not sure I would understand that hint.
> But I think writing A*B/C*D when you mean A*(B/C)*D is poor
> notation.
Writing on paper, yes, but typing it in a pocket calculator, it is
okay. I'm not sure how I'd write it in a spreadsheet program, for
legibility reasons. But if I'd encounter it in someone else's code I
knew how to `parse' it, from left to right. And so do the spreadsheet
programs. And that is the heavy argument in my opinion: spreadsheets
treat * and / equal and evaluate from left to right.
> 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.
But then I say that writing A/B*C and interpreting it like (A/B)*C
saves me the trouble of typing in parentheses and moreover, Calc would
behave like the OpenOffice.org spreadsheet, Gnumeric, Excel, MATLAB,
... simply the things most people nowadays are used too.
I didn't know that Calc has been around for a long time. I'm just
curious how both `sides' could get their favourite behaviour (after
the release): you mentioned that this could be made configurable --
what should be the default behaviour then? Compatibility with the old
behaviour, or `behave as spreadsheets do'? I guess for safety reasons
it should be compatibility ...
Regards,
Christian Schlauer
next prev parent reply other threads:[~2007-04-18 21:55 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-14 11:57 Calc: `*' binds more strongly than `/' Christian Schlauer
2007-04-14 15:09 ` Jay Belanger
2007-04-15 19:21 ` Chong Yidong
2007-04-15 20:05 ` Stefan Monnier
2007-04-17 12:47 ` Randal L. Schwartz
2007-04-17 18:03 ` Stefan Monnier
2007-04-18 8:44 ` Kim F. Storm
2007-04-18 19:27 ` Stefan Monnier
2007-04-18 20:02 ` Davis Herring
2007-04-18 20:16 ` David Kastrup
2007-04-18 21:43 ` Davis Herring
2007-04-19 16:10 ` Stefan Monnier
2007-04-20 11:13 ` Randal L. Schwartz
2007-04-20 13:40 ` Stefan Monnier
2007-04-20 14:07 ` Jay Belanger
2007-04-22 1:31 ` Miles Bader
2007-04-22 10:19 ` Christian Schlauer
2007-04-22 10:23 ` Christian Schlauer
2007-04-22 19:47 ` Jay Belanger
2007-04-23 10:46 ` Jason Rumney
2007-04-23 13:03 ` Kim F. Storm
2007-04-23 15:54 ` Jay Belanger
2007-04-25 19:56 ` Christian Schlauer
2007-04-25 20:54 ` Jay Belanger
2007-04-26 3:35 ` Stefan Monnier
2007-04-26 4:06 ` Jay Belanger
2007-04-26 14:11 ` Stefan Monnier
2007-04-26 21:07 ` Christian Schlauer
2007-04-26 15:07 ` Davis Herring
2007-04-26 16:01 ` Stefan Monnier
2007-04-26 18:32 ` Luc Teirlinck
2007-04-26 21:29 ` Christian Schlauer
2007-04-26 23:17 ` Luc Teirlinck
2007-04-26 21:07 ` Christian Schlauer
2007-04-27 1:27 ` Jay Belanger
2007-04-26 17:47 ` Davis Herring
2007-06-20 15:23 ` Jay Belanger
2007-06-20 16:02 ` Kim F. Storm
2007-06-20 17:13 ` Jay Belanger
2007-06-20 17:29 ` Luc Teirlinck
2007-06-20 17:54 ` Jay Belanger
2007-06-20 19:14 ` Kim F. Storm
2007-06-20 19:28 ` Luc Teirlinck
2007-06-20 20:18 ` Jay Belanger
2007-04-17 18:54 ` Jay Belanger
2007-04-18 21:55 ` Christian Schlauer [this message]
2007-04-19 2:58 ` Daniel Brockman
2007-04-22 10:27 ` Christian Schlauer
2007-04-26 16:00 ` Daniel Brockman
2007-04-19 15:16 ` Drew Adams
2007-04-19 17:05 ` David Kastrup
2007-04-19 17:18 ` Drew Adams
2007-04-19 17:33 ` David Kastrup
2007-04-16 15:38 ` Richard Stallman
2007-04-17 12:47 ` Randal L. Schwartz
2007-04-18 21:29 ` Christian Schlauer
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873b2xz6t9.fsf@totally-fudged-out-message-id \
--to=cs-muelleimer-rubbish.bin@arcor.de \
--cc=cs-usenet@arcor.de \
--cc=emacs-devel@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.