コード例 #1
0
ファイル: moonposition_test.go プロジェクト: soniakeys/meeus
func ExampleParallax() {
	// Example 47.a, p. 342.
	_, _, Δ := moonposition.Position(julian.CalendarGregorianToJD(1992, 4, 12))
	π := moonposition.Parallax(Δ)
	fmt.Printf("π = %.6f\n", π.Deg())
	// Output:
	// π = 0.991990
}
コード例 #2
0
ファイル: moonposition_test.go プロジェクト: soniakeys/meeus
func TestParallax(t *testing.T) {
	// test case from ch 40, p. 280
	got := moonposition.Parallax(.37276 * base.AU).Sec()
	want := 23.592
	if math.Abs(got-want) > .001 {
		t.Error(got, want)
	}
}
コード例 #3
0
ファイル: apsis_test.go プロジェクト: soniakeys/meeus
// Lacking a worked example from the text, test using meeus/moonposition.
func TestPerigeeParallax(t *testing.T) {
	got := apsis.PerigeeParallax(1997.93)
	_, _, d := moonposition.Position(apsis.Perigee(1997.93))
	want := moonposition.Parallax(d)
	Δ := math.Abs((got - want).Sec())
	// for this case anyway it's within a tenth of an arc second
	if Δ > .1 {
		t.Fatal("got", got, "want (about)", want)
	}
}