Esempio n. 1
0
func Test2000(t *testing.T) {
	for i := range mar {
		e := &mar[i]
		approx := solstice.March(e.y)
		vsop87 := julian.CalendarGregorianToJD(e.y, 3, e.d) +
			unit.NewTime(' ', e.h, e.m, e.s).Day()
		if math.Abs(vsop87-approx) > 1./24/60 {
			t.Logf("mar %d: got %.5f expected %.5f", e.y, approx, vsop87)
			t.Errorf("%.0f second error", math.Abs(vsop87-approx)*24*60*60)
		}
	}
	for i := range jun {
		e := &jun[i]
		approx := solstice.June(e.y)
		vsop87 := julian.CalendarGregorianToJD(e.y, 6, e.d) +
			unit.NewTime(' ', e.h, e.m, e.s).Day()
		if math.Abs(vsop87-approx) > 1./24/60 {
			t.Logf("jun %d: got %.5f expected %.5f", e.y, approx, vsop87)
			t.Errorf("%.0f second error", math.Abs(vsop87-approx)*24*60*60)
		}
	}
	for i := range sep {
		e := &sep[i]
		approx := solstice.September(e.y)
		vsop87 := julian.CalendarGregorianToJD(e.y, 9, e.d) +
			unit.NewTime(' ', e.h, e.m, e.s).Day()
		if math.Abs(vsop87-approx) > 1./24/60 {
			t.Logf("sep %d: got %.5f expected %.5f", e.y, approx, vsop87)
			t.Errorf("%.0f day error", math.Abs(vsop87-approx))
		}
	}
	for i := range dec {
		e := &dec[i]
		approx := solstice.December(e.y)
		vsop87 := julian.CalendarGregorianToJD(e.y, 12, e.d) +
			unit.NewTime(' ', e.h, e.m, e.s).Day()
		if math.Abs(vsop87-approx) > 1./24/60 {
			t.Logf("dec %d: got %.5f expected %.5f", e.y, approx, vsop87)
			t.Errorf("%.0f second error", math.Abs(vsop87-approx)*24*60*60)
		}
	}
}
Esempio n. 2
0
func ExampleJune() {
	// Example 27.a, p. 180
	fmt.Printf("%.5f\n", solstice.June(1962))
	// Output:
	// 2437837.39245
}