Coverage Report

Created: 2026-05-16 06:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.1/src/erst/eqeq94.rs
Line
Count
Source
1
use std::ops::Rem;
2
3
use crate::consts::{D2PI, DAS2R, DJ00, DJC};
4
use crate::pnp::{nut80, obl80};
5
use crate::vm::anpm;
6
7
///  Equation of the equinoxes, IAU 1994 model.
8
///
9
///  This function is part of the International Astronomical Union's
10
///  SOFA (Standards of Fundamental Astronomy) software collection.
11
///
12
///  Status:  canonical model.
13
///
14
///  Given:
15
///  ```
16
///     date1,date2   double     TDB date (Note 1)
17
///  ```
18
///  Returned (function value):
19
///  ```
20
///                   double     equation of the equinoxes (Note 2)
21
///  ```
22
///  Notes:
23
///
24
///  1) The date date1+date2 is a Julian Date, apportioned in any
25
///     convenient way between the two arguments.  For example,
26
///     JD(TT)=2450123.7 could be expressed in any of these ways,
27
///     among others:
28
///  ```
29
///            date1          date2
30
///
31
///         2450123.7           0.0       (JD method)
32
///         2451545.0       -1421.3       (J2000 method)
33
///         2400000.5       50123.2       (MJD method)
34
///         2450123.5           0.2       (date & time method)
35
///  ```
36
///     The JD method is the most natural and convenient to use in
37
///     cases where the loss of several decimal digits of resolution
38
///     is acceptable.  The J2000 method is best matched to the way
39
///     the argument is handled internally and will deliver the
40
///     optimum resolution.  The MJD method and the date & time methods
41
///     are both good compromises between resolution and convenience.
42
///
43
///  2) The result, which is in radians, operates in the following sense:
44
///
45
///        Greenwich apparent ST = GMST + equation of the equinoxes
46
///
47
///  Called:
48
///  ```
49
///     iauAnpm      normalize angle into range +/- pi
50
///     iauNut80     nutation, IAU 1980
51
///     iauObl80     mean obliquity, IAU 1980
52
///  ```
53
///  References:
54
///
55
///     IAU Resolution C7, Recommendation 3 (1994).
56
///
57
///     Capitaine, N. & Gontier, A.-M., 1993, Astron.Astrophys., 275,
58
///     645-650.
59
0
pub fn eqeq94(date1: f64, date2: f64) -> f64 {
60
    // double t,  om,  dpsi,  deps,  eps0, ee;
61
62
    /* Interval between fundamental epoch J2000.0 and given date (JC). */
63
0
    let t = ((date1 - DJ00) + date2) / DJC;
64
65
    /* Longitude of the mean ascending node of the lunar orbit on the */
66
    /* ecliptic, measured from the mean equinox of date. */
67
0
    let om = anpm(
68
0
        (450160.280 + (-482890.539 + (7.455 + 0.008 * t) * t) * t) * DAS2R
69
0
            + (-5.0 * t).rem(1.0) * D2PI,
70
    );
71
72
    /* Nutation components and mean obliquity. */
73
0
    let (dpsi, _) = nut80(date1, date2);
74
0
    let eps0 = obl80(date1, date2);
75
76
    /* Equation of the equinoxes. */
77
0
    let ee = dpsi * eps0.cos() + DAS2R * (0.00264 * om.sin() + 0.000063 * (om + om).sin());
78
79
0
    ee
80
0
}