Skip to content

Fold latitude angles correctly across complete turns - #241

Open
xiehuanyi wants to merge 1 commit into
rai-opensource:masterfrom
xiehuanyi:fix-latitude-wrap-periods
Open

xiehuanyi wants to merge 1 commit into
rai-opensource:masterfrom
xiehuanyi:fix-latitude-wrap-periods

Conversation

@xiehuanyi

Copy link
Copy Markdown

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.

This branch has not been deployed

No deployments
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.

2 participants