func ExamplePoly1900to1997() { // Example 10.a, p. 78. jd := julian.TimeToJD(time.Date(1977, 2, 18, 3, 37, 40, 0, time.UTC)) year := base.JDEToJulianYear(jd) fmt.Printf("julian year %.1f\n", year) fmt.Printf("%+.1f seconds\n", deltat.Poly1900to1997(jd)) // Output: // julian year 1977.1 // +47.1 seconds }
func TestPoly1900to1997(t *testing.T) { for y := 1900; y < 1998; y += 2 { jd := julian.CalendarGregorianToJD(y, 0, 0) t.Logf("%d %.2f %.1f", y, jd, deltat.Poly1900to1997(jd)) } for _, tp := range []struct { year int ΔT float64 }{ {1900, -2.8}, {1950, 29.1}, {1996, 61.6}, } { jd := julian.CalendarGregorianToJD(tp.year, 0, 0) ΔT := deltat.Poly1900to1997(jd) if math.Abs(ΔT-tp.ΔT) > 1 { t.Fatalf("%#v, got %.1f", tp, ΔT) } } }