From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ulrich =?UTF-8?Q?M=C3=BCller?= Newsgroups: gmane.emacs.bugs Subject: bug#61460: 30.0.50; Calendar shows eclipse for quarter moon Date: Tue, 14 Feb 2023 11:22:56 +0100 Message-ID: References: <87sffab61y.fsf@web.de> <87cz6eb10y.fsf@web.de> <87r0uu9e5v.fsf@web.de> <87mt5i9cba.fsf@web.de> <875yc4q0ee.fsf@web.de> <87y1p0obe8.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2542"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) To: 61460@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 14 11:24:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRsTu-0000Vh-W1 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Feb 2023 11:24:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRsTk-0004Br-9x; Tue, 14 Feb 2023 05:24:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRsTi-0004Bf-Tb for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 05:24:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRsTi-0004A3-J9 for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 05:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pRsTi-0001JX-9P for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 05:24:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Ulrich =?UTF-8?Q?M=C3=BCller?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Feb 2023 10:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61460 X-GNU-PR-Package: emacs Original-Received: via spool by 61460-submit@debbugs.gnu.org id=B61460.16763701994993 (code B ref 61460); Tue, 14 Feb 2023 10:24:02 +0000 Original-Received: (at 61460) by debbugs.gnu.org; 14 Feb 2023 10:23:19 +0000 Original-Received: from localhost ([127.0.0.1]:52639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRsSx-0001IK-9S for submit@debbugs.gnu.org; Tue, 14 Feb 2023 05:23:19 -0500 Original-Received: from woodpecker.gentoo.org ([140.211.166.183]:40656 helo=smtp.gentoo.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRsSp-0001HS-6r for 61460@debbugs.gnu.org; Tue, 14 Feb 2023 05:23:14 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:255562 Archived-At: Next round: The following simplifies the calculation and IMHO makes it much easier to understand. Results are identical, and tests pass. Alternatively, we could leave the result in degrees (as all other calculations in lunar.el are in degrees) and change the values in the final cond to 13.9 and 21.2 degrees. This would also get rid of the excessive number of digits. >From 32609db770004aa787c05753a1f90fe906c07c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20M=C3=BCller?= Date: Tue, 14 Feb 2023 11:12:29 +0100 Subject: [PATCH] ; Simplify eclipse calculation in calendar/lunar.el * lisp/calendar/lunar.el (eclipse-check): Calculate moon-lat in degrees, then convert to radians. --- lisp/calendar/lunar.el | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el index 8ced4144105..ec31ea596ea 100644 --- a/lisp/calendar/lunar.el +++ b/lisp/calendar/lunar.el @@ -155,14 +155,11 @@ remainder mod 4 gives the phase: 0 new moon, 1 first quarter, 2 full moon, ;; from "Astronomy with your Personal Computer", Subroutine Eclipse ;; Line 7000 Peter Duffett-Smith Cambridge University Press 1990 (defun eclipse-check (moon-lat phase) - (let* ((moon-lat (* (/ float-pi 180) moon-lat)) - ;; For positions near the ascending or descending node, - ;; calculate the absolute angular distance from that node. - (moon-lat (abs (- moon-lat (* (floor (/ moon-lat float-pi)) - float-pi)))) - (moon-lat (if (> moon-lat 0.37) ; FIXME (* 0.5 float-pi) - (- float-pi moon-lat) - moon-lat)) + (let* ((moon-lat (mod moon-lat 180)) + ;; Calculate the absolute angular distance from the ascending + ;; or descending node, whichever is nearer. + (moon-lat (min moon-lat (- 180 moon-lat))) + (moon-lat (degrees-to-radians moon-lat)) (phase-name (cond ((= phase 0) "Solar") ((= phase 2) "Lunar") (t "")))) -- 2.39.1