Subject: Re: bug#61460: 30.0.50; Calendar shows eclipse for quarter moon

From: Ulrich Mueller <[email-masked]>
Date: Mon, 13 Feb 2023 08:28:29 +0100

>>>>> On Mon, 13 Feb 2023, Michael Heerdegen wrote:

> BTW (3), I also don't understand those conversions of the latitude:

> #+begin_src emacs-lisp
> (defun eclipse-check (moon-lat phase)
>   (let* ((moon-lat (* (/ float-pi 180) moon-lat))
>          (moon-lat (abs (- moon-lat (* (floor (/ moon-lat float-pi))
>                                        float-pi))))
>          (moon-lat (if (> moon-lat 0.37)
>                        (- float-pi moon-lat)
>                      moon-lat))
>          (...))
>     (...)))
> #+end_src

> What does this do?  Don't we just want to convert a value in [0 360) to
> one in [-pi pi] and use the absolute value of that, or so?  That would
> look like

>   (abs (* (/ float-pi 180) (- moon-lat 180)))

> Why is our calculation so complicated?

IIUC, the goal is to calculate the angular distance from the ascending
or descending node, whichever is closer. So one wants this:

     0° ->  0°
    10° -> 10°
   ...
   170° -> 10°
   180° ->  0°
   190° -> 10°
   ...
   350° -> 10°

The only thing that I don't understand is the constant 0.37. I would
have expected pi/2 (= 90°) there. Probably it doesn't matter, because
below it checks for (< moon-lat 0.37), so any larger value will be
ignored.

>>>>> On Mon, 13 Feb 2023, Michael Heerdegen wrote:

> Why the is latitude of the moon:

> #+begin_src emacs-lisp
> (moon-lat (mod
>             (+ 21.2964
>                (* 390.67050646 index)
>                (* -0.0016528 time time)
>                (* -0.00000239 time time time))
>             360.0))
> #+end_src

> calculated as a mod 360.0 value?  I would expect this for the longitude,
> latitude should be in -90°...90° AFAIU.  Is it a typo?

No, the argument of latitude is the angle of the body measured from
the ascending node of its orbit. So its values are expected to be
between 0° and 360°.