[PROJ] spilhaus regresssion test failures

Greg Troxel gdt at lexort.com
Sun May 4 11:27:45 PDT 2025


Javier Jimenez Shaw <j1 at jimenezshaw.com> writes:

> The PR was https://github.com/OSGeo/PROJ/pull/4446
>
> Maybe the function that impacts the tests is "pj_conformal_lat_inverse".
> You can try with the new implementation.
> The changes should be small. (See that the signature of the function is a
> bit different). It is used only in one place.


Do you mean:

  take proj 9.6.0

  read the diff to pj_conformal_lat_inverse from the PR, and hand patch
  it in, except not changing the signature

  build and rerun tests

I guess I could further keep the code and compare the two results.


I looked at that code, and it jumped out at me that are abs() was used,
which is a C function, not C++, and is integer only.

With this patch (to 9.6.0), I get a pass:

--- src/latitudes.cpp.~1~       2025-03-13 10:31:27.000000000 -0400
+++ src/latitudes.cpp   2025-05-04 14:23:04.656697860 -0400
@@ -58,7 +58,7 @@
             2 * atan(taninit *
                      std::pow(((1 + esinphi) / (1 - esinphi)), (e / 2))) -
             0.5 * M_PI;
-        if (abs(new_phi - phi) < threshold) {
+        if (std::abs(new_phi - phi) < threshold) {
             phi = new_phi;
             break;
         }

Interesting that this only causes trouble with spilhaus, at least as far
as tests catch it.


More information about the PROJ mailing list