Skip to content

Fold latitude angles correctly across complete turns - #241

Merged
taughz merged 1 commit into
rai-opensource:masterfrom
xiehuanyi:fix-latitude-wrap-periods
Oct 13, 2026
Merged

taughz merged 1 commit into
rai-opensource:masterfrom
xiehuanyi:fix-latitude-wrap-periods

Conversation

@xiehuanyi

Copy link
Copy Markdown
Contributor

wrap_mpi2_pi2() returns latitude angles outside its documented [-pi/2, pi/2] range after complete turns: wrap_mpi2_pi2(2*pi) currently returns -2*pi, and 3*pi/2 is left unchanged.

Reduce complete turns while preserving the sign and precision of small angles, then reflect the remaining angle about the poles. Scalar/vector return behavior is unchanged, and the general angle_wrap(..., mode="-pi/2:pi/2") dispatcher receives the same correction.

Regression tests cover positive/negative complete and half turns from -4pi through4pi, scalar/vector forms, the dispatcher, both sides of each pole, exact1e-16 angles and empty vectors. The multiple-turn regression fails before the fix. All20 vector tests pass after it; the broader base suite passes149 tests with1 skip and5 existing warnings. The repository-pinned Black23.10.0 and git diff --check pass.

Prepared with AI assistance.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 17:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@taughz taughz mentioned this pull request Oct 11, 2026
7 tasks done
@taughz
taughz force-pushed the fix-latitude-wrap-periods branch from c19495d to b8627b0 Compare October 13, 2026 17:15
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@taughz
taughz merged commit 6ed7eff into rai-opensource:master Oct 13, 2026
13 checks passed
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

Successfully merging this pull request may close these issues.

4 participants