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

Make distance calculation more stable #134

Closed
jenetics opened this issue Oct 16, 2020 · 1 comment
Closed

Make distance calculation more stable #134

jenetics opened this issue Oct 16, 2020 · 1 comment
Assignees
Milestone

Comments

@jenetics
Copy link
Owner

The current implementation for calculating the distance between two points contains code, where values are checked against zero.

// Eq. 17 Careful! sin2sigma might be almost 0!
final double sinalpha = sin2sigma == 0.0
	? 0.0
	: cosU1cosU2*sinlambda/sinsigma;

This kind of comparison isn't numerically stable. Replace this code with an epsilon check.

@jenetics jenetics added this to the v2.1.0 milestone Oct 16, 2020
@jenetics jenetics self-assigned this Oct 16, 2020
jenetics added a commit that referenced this issue Oct 16, 2020
jenetics added a commit that referenced this issue Oct 16, 2020
jenetics added a commit that referenced this issue Oct 16, 2020
jenetics added a commit that referenced this issue Oct 16, 2020
@jenetics
Copy link
Owner Author

Merged into r2.1.0 branch.

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

No branches or pull requests

1 participant