示例#1
0
文件: deltat.go 项目: thecc4re/meeus
func Interp10A(jde float64) float64 {
	// kind of crazy, working in calendar years, but it seems that's what
	// we're supposed to do.
	y, m, d := julian.JDToCalendar(jde)
	l := julian.LeapYearGregorian(y)
	yl := 365.
	if l {
		yl++
	}
	yf := float64(y) + float64(julian.DayOfYear(y, m, int(d+.5), l))/yl
	d3, err := interp.Len3ForInterpolateX(yf, tableYear1, tableYearN, table10A)
	if err != nil {
		panic(err) // error would indicate a bug in interp.Slice.
	}
	return d3.InterpolateX(yf)
}
示例#2
0
func TestGregLeap(t *testing.T) {
	for _, tp := range []struct {
		year int
		leap bool
	}{
		{1700, false},
		{1800, false},
		{1900, false},
		{2100, false},
		{1600, true},
		{2000, true},
		{2400, true},
	} {
		if julian.LeapYearGregorian(tp.year) != tp.leap {
			t.Logf("%#v", tp)
			t.Fatal("JuliLeapYear")
		}
	}
}