Repository navigation
Commit 6ed7eff
authored
Fold latitude angles correctly across complete turns (#241)
`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
-4*pi through4*pi, 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.1 parent 65daaad commit 6ed7eff
2 files changed
Lines changed: 28 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
577 | 574 | | |
578 | 575 | | |
579 | 576 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
281 | 305 | | |
282 | 306 | | |
283 | 307 | | |
| |||
0 commit comments