From unknown Sun Aug 10 07:36:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41925: 28.0.50; Error using calc-degrees-mode with calc-base-units Resent-From: Julien Cubizolles Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Jun 2020 19:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41925 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 41925@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.159242218117453 (code B ref -1); Wed, 17 Jun 2020 19:30:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 Jun 2020 19:29:41 +0000 Received: from localhost ([127.0.0.1]:52215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jldkj-0004XR-8c for submit@debbugs.gnu.org; Wed, 17 Jun 2020 15:29:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:42444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jldkh-0004XJ-GE for submit@debbugs.gnu.org; Wed, 17 Jun 2020 15:29:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jldkh-0004eR-9W for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2020 15:29:39 -0400 Received: from smtp3-g21.free.fr ([212.27.42.3]:61920) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jldkf-0000Uy-Gi for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2020 15:29:39 -0400 Received: from lago (unknown [IPv6:2a01:e0a:1de:7910:5b07:748f:98ba:5b58]) (Authenticated sender: j.cubizolles) by smtp3-g21.free.fr (Postfix) with ESMTPSA id 3CFD213F8B6 for ; Wed, 17 Jun 2020 21:29:33 +0200 (CEST) From: Julien Cubizolles Date: Wed, 17 Jun 2020 21:29:32 +0200 Message-ID: <87pn9x7aoz.fsf@free.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: none client-ip=212.27.42.3; envelope-from=j.cubizolles@free.fr; helo=smtp3-g21.free.fr X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 15:29:34 X-ACL-Warn: Detected OS = Windows NT kernel [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, SPOOFED_FREEMAIL=1, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: -0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) In algebraic mode, with calc-degrees-mode, arctan(ga/(9.8 m/s^2)) gives 0.7857 (close pi/4 radians) instead of 45=C2=B0 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 From unknown Sun Aug 10 07:36:39 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41925: 28.0.50; Error using calc-degrees-mode with calc-base-units References: <87pn9x7aoz.fsf@free.fr> In-Reply-To: <87pn9x7aoz.fsf@free.fr> Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Jun 2020 16:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41925 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Julien Cubizolles Cc: 41925@debbugs.gnu.org Received: via spool by 41925-submit@debbugs.gnu.org id=B41925.159266937621367 (code B ref 41925); Sat, 20 Jun 2020 16:10:01 +0000 Received: (at 41925) by debbugs.gnu.org; 20 Jun 2020 16:09:36 +0000 Received: from localhost ([127.0.0.1]:58651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jmg3k-0005YZ-11 for submit@debbugs.gnu.org; Sat, 20 Jun 2020 12:09:36 -0400 Received: from mail78c50.megamailservers.eu ([91.136.10.88]:40384 helo=mail70c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jmg3g-0005YN-1F for 41925@debbugs.gnu.org; Sat, 20 Jun 2020 12:09:34 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1592669370; bh=I6mAzmPIBe0NtMm8Ooqd8W8kht9Mg6U5XAzs8WQjWbM=; h=From:Subject:Date:Cc:To:From; b=qk5+Iaa6QZHWt4VZfvt+Jcl+iZnLd8cb8PupQKHuKY2T+gxscnWs0NBeMgfVcxxO+ tWfSplTXW6DiKrwzJ8HcaH981Zb7ir9+cvqCPcaqMYaq7pm2HX3qrCTs55boaEjbvw KcV2ECA72YaTAxiTqGhUU6c4uqWO4iQOxayw/l3E= Feedback-ID: mattiase@acm.or Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail70c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 05KG9SDD003259; Sat, 20 Jun 2020 16:09:29 +0000 From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Message-Id: <6E1D5605-E61F-4E96-899A-77A6AC8AB5ED@acm.org> Date: Sat, 20 Jun 2020 18:09:27 +0200 X-Mailer: Apple Mail (2.3445.104.14) X-CTCH-RefID: str=0001.0A782F20.5EEE3421.005E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=OKBZIhSB c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=IkcTkHD0fZMA:10 a=VF7Ow1OpVmoA:10 a=M51BFTxLslgA:10 a=CUW0FxpPLF7tKjO4kpAA:9 a=QEXdDO2ut3YA:10 X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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-mo [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.3 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 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*(=CF=80/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.