Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index out of range error in planetelements.Mean() #19

Open
chrissnell opened this issue Jan 19, 2024 · 2 comments
Open

index out of range error in planetelements.Mean() #19

chrissnell opened this issue Jan 19, 2024 · 2 comments

Comments

@chrissnell
Copy link

	jde := julian.TimeToJD(time.Now())
	var e planetelements.Elements
	planetelements.Mean(planetelements.Earth, jde, &e)
	earthSemiMajorAxis := e.Axis
	fmt.Println("semi-major axis of Earth:", earthSemiMajorAxis)

yields:


goroutine 1 [running]:
github.com/soniakeys/meeus/v3/base.Horner(...)
        /Users/cjs/dev/go/pkg/mod/github.com/soniakeys/meeus/[email protected]/base/math.go:29
github.com/soniakeys/meeus/v3/planetelements.Mean(0x100c77018?, 0x1400005c010?, 0x14000108e98)
        /Users/cjs/dev/go/pkg/mod/github.com/soniakeys/meeus/[email protected]/planetelements/planetelements.go:129 +0x20c
main.main()
        /Users/cjs/dev/solar/main.go:35 +0x174
exit status 2```
@chrissnell
Copy link
Author

I think a more Go-like way to implement this would be to have the code work something like this:

element := planetelements.New(planet.Earth)
fmt.Println("semi-major axis:", element.Axis())

@chrissnell
Copy link
Author

I see that Sonia has passed. Maybe someone else will take up this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant