Skip to main content

sofars/erst/
ee06a.rs

1use super::{gmst06, gst06a};
2use crate::vm::anpm;
3
4///  Equation of the equinoxes, IAU 2006/2000A
5///
6///  Equation of the equinoxes, compatible with IAU 2000 resolutions and
7///  IAU 2006/2000A precession-nutation.
8///
9///  This function is part of the International Astronomical Union's
10///  SOFA (Standards of Fundamental Astronomy) software collection.
11///
12///  Status:  support function.
13///
14///  Given:
15///  ```
16///     date1,date2  double    TT as a 2-part Julian Date (Note 1)
17///  ```
18///  Returned (function value):
19///  ```
20///                  double    equation of the equinoxes (Note 2)
21///  ```
22///  Notes:
23///
24///  1) The TT 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///     iauGst06a    Greenwich apparent sidereal time, IAU 2006/2000A
51///     iauGmst06    Greenwich mean sidereal time, IAU 2006
52///  ```
53///  Reference:
54///
55///     McCarthy, D. D., Petit, G. (eds.), 2004, IERS Conventions (2003),
56///     IERS Technical Note No. 32, BKG
57pub fn ee06a(date1: f64, date2: f64) -> f64 {
58    let _gst06a = gst06a(0.0, 0.0, date1, date2);
59    let _gmst06 = gmst06(0.0, 0.0, date1, date2);
60
61    // Equation of the equinoxes.
62    let ee = anpm(_gst06a - _gmst06);
63
64    ee
65}