(d)
| 23 | // negligible for the Sun (<0.001°), real for the Moon. d only needs ~month accuracy here (ΔT |
| 24 | // changes <1 s/yr), so the decimal year is derived arithmetically from d rather than from the Date. |
| 25 | function deltaT(d) { |
| 26 | const y = 2000 + d / 365.2425; |
| 27 | let t; |
| 28 | if (y < 1920) { t = y - 1900; return -2.79 + t * (1.494119 + t * (-0.0598939 + t * (0.0061966 - t * 0.000197))); } |
| 29 | if (y < 1941) { t = y - 1920; return 21.20 + t * (0.84493 + t * (-0.076100 + t * 0.0020936)); } |
| 30 | if (y < 1961) { t = y - 1950; return 29.07 + t * (0.407 + t * (-1 / 233 + t / 2547)); } |
| 31 | if (y < 1986) { t = y - 1975; return 45.45 + t * (1.067 + t * (-1 / 260 - t / 718)); } |
| 32 | if (y < 2005) { t = y - 2000; return 63.86 + t * (0.3345 + t * (-0.060374 + t * (0.0017275 + t * (0.000651814 + t * 0.00002373599)))); } |
| 33 | if (y < 2050) { t = y - 2000; return 62.92 + t * (0.32217 + t * 0.005589); } |
| 34 | t = (y - 1820) / 100; return -20 + 32 * t * t - 0.5628 * (2150 - y); |
| 35 | } |
| 36 | function toDaysTT(d) { |
| 37 | return d + deltaT(d) / 86400; |
| 38 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…