* bug#41925: 28.0.50; Error using calc-degrees-mode with calc-base-units
@ 2020-06-17 19:29 Julien Cubizolles
2020-06-20 16:09 ` Mattias Engdegård
0 siblings, 1 reply; 2+ messages in thread
From: Julien Cubizolles @ 2020-06-17 19:29 UTC (permalink / raw)
To: 41925
In algebraic mode, with calc-degrees-mode, arctan(ga/(9.8 m/s^2)) gives
0.7857 (close pi/4 radians) instead of 45° as it should. I'm converting
units with calc-base-units, bound to u-b.
Pushing ga/(9.8 m/s^2), then doing u b and I T gives however 45.
In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.18, cairo version 1.16.0) of 2020-06-14 built on lcy01-amd64-003
Windowing system distributor 'The X.Org Foundation', version
11.0.12008000 System Description: Ubuntu 20.04 LTS
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#41925: 28.0.50; Error using calc-degrees-mode with calc-base-units
2020-06-17 19:29 bug#41925: 28.0.50; Error using calc-degrees-mode with calc-base-units Julien Cubizolles
@ 2020-06-20 16:09 ` Mattias Engdegård
0 siblings, 0 replies; 2+ messages in thread
From: Mattias Engdegård @ 2020-06-20 16:09 UTC (permalink / raw)
To: Julien Cubizolles; +Cc: 41925
It looks like Calc explicitly switches to radians mode during simplification with units:
(defun math-from-radians (a) ; [N N]
(cond ((and (not math-simplifying-units)
(eq calc-angle-mode 'deg))
(if (math-constp a)
(math-div a (math-pi-over-180))
(list 'calcFunc-deg a)))
((eq calc-angle-mode 'hms)
(math-to-hms a 'rad))
(t a)))
Presumably, this is done because the unit calculations somehow expect everything to be done in radians. I'm not sure how the machinery works, but to hazard a guess, suppose that
sin(30 deg)
would unit-simplify into
sin(30*(π/180))
then that would only give the right result if sin(x) only accepted radians no matter the current angle mode during this simplification process.
Obviously I didn't write Calc, and am not sure how to solve it without blowing something else apart. Perhaps you want to give it a go?
It also seems unclear how units and angle mode are supposed to interact. In degrees mode, arctan(1) evaluates to a dimensionless 45, not 45 deg.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-20 16:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-17 19:29 bug#41925: 28.0.50; Error using calc-degrees-mode with calc-base-units Julien Cubizolles
2020-06-20 16:09 ` Mattias Engdegård
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.