* bug#43902: 28.0.50; Calc: Wrong eval precedence rules with LaTeX language
@ 2020-10-10 7:02 Michael Heerdegen
2020-10-10 10:03 ` Mattias Engdegård
0 siblings, 1 reply; 7+ messages in thread
From: Michael Heerdegen @ 2020-10-10 7:02 UTC (permalink / raw)
To: 43902
Hello,
here is a recipe for emacs -Q:
M-x calc RET
d L ;; calc-latex-language
' ;; calc-algebraic-entry
1+1/2 RET
The result is 1, and the Trail shows alg' (1 + 1) / 2. It does not make
much sense to me to use a precedence rule where addition has higher
precedence than division. I know LaTeX a bit and don't expect such a
result, and it doesn't seem to be documented. Is it intended or a bug?
TIA,
Michael.
In GNU Emacs 28.0.50 (build 62, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.16.0)
of 2020-10-09 built on drachen
Repository revision: 6b346963d5a5bdb37cf3ecb50ce6d7dc6ec32d20
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Debian GNU/Linux bullseye/sid
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#43902: 28.0.50; Calc: Wrong eval precedence rules with LaTeX language
2020-10-10 7:02 bug#43902: 28.0.50; Calc: Wrong eval precedence rules with LaTeX language Michael Heerdegen
@ 2020-10-10 10:03 ` Mattias Engdegård
2020-10-13 9:40 ` Mattias Engdegård
0 siblings, 1 reply; 7+ messages in thread
From: Mattias Engdegård @ 2020-10-10 10:03 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 43902, Jay Belanger
Michael Heerdegen dixit:
> M-x calc RET
> d L ;; calc-latex-language
> ' ;; calc-algebraic-entry
> 1+1/2 RET
>
> The result is 1, and the Trail shows alg' (1 + 1) / 2. It does not make
> much sense to me to use a precedence rule where addition has higher
> precedence than division. I know LaTeX a bit and don't expect such a
> result, and it doesn't seem to be documented. Is it intended or a bug?
Indeed, $a+b/c$ is typeset by (La)TeX as (approx.) a + b/c which can only mean one thing, but Calc incorrectly parses it as (a+b)/c. This seems to be the consequence of an explicit change:
commit fda9b316f84dbc6d68e6cb74b386ee4b92d81b31
Author: Jay Belanger <jay.p.belanger@gmail.com>
Date: Fri Nov 16 04:15:23 2007 +0000
(math-oper-table): Fix typo. Reduce precedence of "/" for TeX.
--- a/lisp/calc/calc-lang.el
+++ b/lisp/calc/calc-lang.el
- ( "/" / 185 186 )
+ ( "/" / 170 171 )
Jay, do you remember the reason for this change?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#43902: 28.0.50; Calc: Wrong eval precedence rules with LaTeX language
2020-10-10 10:03 ` Mattias Engdegård
@ 2020-10-13 9:40 ` Mattias Engdegård
2020-10-13 16:22 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Mattias Engdegård @ 2020-10-13 9:40 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Jay Belanger, 43902-done
Very well, since Jay couldn't recall the reason for the precedence change either -- it was a long time ago -- I have no reverted it back to the previous level where it sits between '+' and '*', which should be compatible with how humans interpret what TeX renders.
Pushed to master and closed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#43902: 28.0.50; Calc: Wrong eval precedence rules with LaTeX language
2020-10-13 9:40 ` Mattias Engdegård
@ 2020-10-13 16:22 ` Eli Zaretskii
2020-10-13 18:03 ` Mattias Engdegård
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-10-13 16:22 UTC (permalink / raw)
To: Mattias Engdegård; +Cc: michael_heerdegen, 43902
> From: Mattias Engdegård <mattiase@acm.org>
> Date: Tue, 13 Oct 2020 11:40:43 +0200
> Cc: Jay Belanger <jay.p.belanger@gmail.com>, 43902-done@debbugs.gnu.org
>
> Very well, since Jay couldn't recall the reason for the precedence change either -- it was a long time ago -- I have no reverted it back to the previous level where it sits between '+' and '*', which should be compatible with how humans interpret what TeX renders.
>
> Pushed to master and closed.
Thanks, but should this change be called out in NEWS?
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-10-14 7:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-10 7:02 bug#43902: 28.0.50; Calc: Wrong eval precedence rules with LaTeX language Michael Heerdegen
2020-10-10 10:03 ` Mattias Engdegård
2020-10-13 9:40 ` Mattias Engdegård
2020-10-13 16:22 ` Eli Zaretskii
2020-10-13 18:03 ` Mattias Engdegård
2020-10-13 18:22 ` Eli Zaretskii
2020-10-14 7:26 ` Mattias Engdegård
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).