GNU bug report logs - #41925
28.0.50; Error using calc-degrees-mode with calc-base-units

Previous Next

Package: emacs;

Reported by: Julien Cubizolles <j.cubizolles <at> free.fr>

Date: Wed, 17 Jun 2020 19:30:02 UTC

Severity: normal

Found in version 28.0.50

Full log


View this message in rfc822 format

From: Mattias Engdegård <mattiase <at> acm.org>
To: Julien Cubizolles <j.cubizolles <at> free.fr>
Cc: 41925 <at> debbugs.gnu.org
Subject: bug#41925: 28.0.50; Error using calc-degrees-mode with calc-base-units
Date: Sat, 20 Jun 2020 18:09:27 +0200
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.





This bug report was last modified 5 years and 52 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.