[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Calc: `*' binds more strongly than `/'
From: |
Luc Teirlinck |
Subject: |
Re: Calc: `*' binds more strongly than `/' |
Date: |
Wed, 20 Jun 2007 14:28:45 -0500 (CDT) |
Jay Belanger wrote:
I can't offhand; that's what I asked about.
It can never make any difference in an expression containing only *
and /.
Indeed, what happens with equal precedence and left associativity in
an expression without parentheses containing only * and / is that any
`* a' (`/ a'. resp.) anywhere in the expression results in the final
result being bigger by (smaller by, resp.) a factor of a. Giving /
higher precedence results in exactly the same.
Things do make a difference if a third "multiplicative type operator",
say mod, is involved. If you give / and * equal precedence, then you
can be consistent and give these other ones exactly the same
precedence, and use left associativity (this is exactly what most
mathematical software I know of does with `mod', _unless_ they
_require_, as many do, explicit parentheses do disambiguate and throw
an error if these parentheses are missing). But if you give / higher
precedence than *. then you have to decide which relative precedence
these other operators get. Of course, that same problem occurs just
as much if you give * higher precedence than /, as Calc did up to know
and still does by default now (unless I misunderstood).
I do not know what preference Calc gives to mod, relative to / and *,
for either value of `calc-multiplication-has-precedence'.
Sincerely,
Luc.