From: "Ulrich Müller" <ulm@gentoo.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Eli Zaretskii <eliz@gnu.org>, 61460@debbugs.gnu.org
Subject: bug#61460: 30.0.50; Calendar shows eclipse for quarter moon
Date: Fri, 17 Feb 2023 08:03:47 +0100 [thread overview]
Message-ID: <ufsb4ai3w@gentoo.org> (raw)
In-Reply-To: <87pma8q2w1.fsf@web.de> (Michael Heerdegen's message of "Fri, 17 Feb 2023 06:25:50 +0100")
>>>>> On Fri, 17 Feb 2023, Michael Heerdegen wrote:
> I have some more cosmetic changes:
> [...]
> (node-dist (funcall (lambda (x) (min x (- 180 x)))
> (mod moon-lat 180))))
I didn't go for this one, because IMHO it is too clever and would
worsen readability of the code. (Also, there is precedent for
successive rebinding in function lunar-phase.)
> In particular, the name of the global function should start with
> "lunar-". Does that look ok?
Thank you. Updated patch below.
From 4a3abeac5c6614c9b0b346767627f978b2dd138a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm@gentoo.org>
Date: Thu, 16 Feb 2023 20:09:22 +0100
Subject: [PATCH] ; Adjust limit for eclipse in calendar/lunar.el, rename
function
* lisp/calendar/lunar.el (lunar-check-for-eclipse): Renamed from
'eclipse-check'; thanks to Michael Heerdegen for the suggestion.
Slightly adjust the upper limit for the distance from the node to
the value found in literature. (bug#61460)
---
lisp/calendar/lunar.el | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el
index 1f827ca34b0..fe8129ec511 100644
--- a/lisp/calendar/lunar.el
+++ b/lisp/calendar/lunar.el
@@ -94,7 +94,7 @@ remainder mod 4 gives the phase: 0 new moon, 1 first quarter, 2 full moon,
(* -0.0016528 time time)
(* -0.00000239 time time time))
360.0))
- (eclipse (eclipse-check moon-lat phase))
+ (eclipse (lunar-check-for-eclipse moon-lat phase))
(adjustment
(if (memq phase '(0 2))
(+ (* (- 0.1734 (* 0.000393 time))
@@ -154,19 +154,18 @@ 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)
+(defun lunar-check-for-eclipse (moon-lat phase)
(let* ((node-dist (mod moon-lat 180))
;; Absolute angular distance from the ascending or descending
;; node, whichever is nearer.
(node-dist (min node-dist (- 180 node-dist)))
- (phase-name (cond ((= phase 0) "Solar")
- ((= phase 2) "Lunar")
- (t ""))))
- (cond
- ((string= phase-name "") "")
- ((< node-dist 13.9) (concat "** " phase-name " Eclipse **"))
- ((< node-dist 21.2) (concat "** " phase-name " Eclipse possible **"))
- (t ""))))
+ (type (cond ((= phase 0) "Solar")
+ ((= phase 2) "Lunar"))))
+ (cond ((not type) "")
+ ;; Limits 13.9° and 21.0° from Meeus (1991), page 350.
+ ((< node-dist 13.9) (concat "** " type " Eclipse **"))
+ ((< node-dist 21.0) (concat "** " type " Eclipse possible **"))
+ (t ""))))
(defconst lunar-cycles-per-year 12.3685 ; 365.25/29.530588853
"Mean number of lunar cycles per 365.25 day year.")
--
2.39.2
next prev parent reply other threads:[~2023-02-17 7:03 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-12 19:57 bug#61460: 30.0.50; Calendar shows eclipse for quarter moon Ulrich Mueller
2023-02-12 20:07 ` Ulrich Müller
2023-02-12 20:19 ` Eli Zaretskii
2023-02-12 21:13 ` Ulrich Mueller
2023-02-13 3:24 ` Eli Zaretskii
2023-02-13 3:25 ` Michael Heerdegen
2023-02-13 4:52 ` Michael Heerdegen
2023-02-13 5:13 ` Michael Heerdegen
2023-02-13 6:01 ` Michael Heerdegen
2023-02-13 7:28 ` Ulrich Mueller
2023-02-13 8:13 ` Michael Heerdegen
2023-02-13 8:52 ` Michael Heerdegen
2023-02-13 9:34 ` Ulrich Mueller
2023-02-13 10:04 ` Michael Heerdegen
2023-02-13 13:03 ` Eli Zaretskii
2023-02-13 13:30 ` Ulrich Mueller
2023-02-13 14:05 ` Eli Zaretskii
2023-02-14 5:30 ` Michael Heerdegen
2023-02-14 7:59 ` Ulrich Mueller
2023-02-14 9:15 ` Michael Heerdegen
2023-02-14 10:22 ` Ulrich Müller
2023-02-14 10:56 ` Michael Heerdegen
2023-02-16 20:26 ` Ulrich Müller
2023-02-17 5:25 ` Michael Heerdegen
2023-02-17 7:03 ` Ulrich Müller [this message]
2023-02-17 7:20 ` Michael Heerdegen
2023-02-18 5:53 ` Michael Heerdegen
2023-02-18 8:56 ` Ulrich Mueller
2023-02-18 9:16 ` Michael Heerdegen
2023-02-21 15:15 ` Michael Heerdegen
2023-02-22 9:00 ` Ulrich Mueller
2023-02-22 9:45 ` Andreas Schwab
2023-02-22 10:03 ` Michael Heerdegen
2023-02-22 11:32 ` Ulrich Mueller
2023-02-22 14:19 ` Michael Heerdegen
2023-02-22 15:46 ` Ulrich Mueller
2023-02-22 16:26 ` Michael Heerdegen
2023-02-25 16:13 ` Michael Heerdegen
2023-02-14 13:31 ` Eli Zaretskii
2023-02-14 10:49 ` Ulrich Mueller
2023-02-13 6:21 ` Ulrich Mueller
2023-02-13 7:08 ` Michael Heerdegen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ufsb4ai3w@gentoo.org \
--to=ulm@gentoo.org \
--cc=61460@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=michael_heerdegen@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).