diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2020-02-08 10:17:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-08 10:17:18 +0100 |
| commit | ead6a66d9830e1f3e0f49a9d46fcd500f342f20f (patch) | |
| tree | 960c4a5511f10fca7f51e1bd1176485bfc9f2204 /src | |
| parent | b6f442db6c6b8a05fb9d824729cb4593e519edf8 (diff) | |
| parent | 7001c21828420f027f5984132d551af99794f1e4 (diff) | |
| download | PROJ-ead6a66d9830e1f3e0f49a9d46fcd500f342f20f.tar.gz PROJ-ead6a66d9830e1f3e0f49a9d46fcd500f342f20f.zip | |
Merge pull request #1917 from rouault/fix_test_issues_on_i386
Fix test issues on i386
Diffstat (limited to 'src')
| -rw-r--r-- | src/projections/laea.cpp | 3 | ||||
| -rw-r--r-- | src/projections/robin.cpp | 2 | ||||
| -rw-r--r-- | src/projections/vandg.cpp | 10 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/projections/laea.cpp b/src/projections/laea.cpp index a1e4bf8f..3d135864 100644 --- a/src/projections/laea.cpp +++ b/src/projections/laea.cpp @@ -44,7 +44,8 @@ static PJ_XY laea_e_forward (PJ_LP lp, PJ *P) { /* Ellipsoidal, forward if (Q->mode == OBLIQ || Q->mode == EQUIT) { sinb = q / Q->qp; - cosb = sqrt(1. - sinb * sinb); + const double cosb2 = 1. - sinb * sinb; + cosb = cosb2 > 0 ? sqrt(cosb2) : 0; } switch (Q->mode) { diff --git a/src/projections/robin.cpp b/src/projections/robin.cpp index 2e36106a..5a3b081c 100644 --- a/src/projections/robin.cpp +++ b/src/projections/robin.cpp @@ -84,7 +84,7 @@ static PJ_XY robin_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forwar (void) P; dphi = fabs(lp.phi); - i = isnan(lp.phi) ? -1 : lround(floor(dphi * C1)); + i = isnan(lp.phi) ? -1 : lround(floor(dphi * C1 + 1e-15)); if( i < 0 ){ proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION); return xy; diff --git a/src/projections/vandg.cpp b/src/projections/vandg.cpp index 7d485aff..e7cbbdb6 100644 --- a/src/projections/vandg.cpp +++ b/src/projections/vandg.cpp @@ -39,6 +39,14 @@ static PJ_XY vandg_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forwar g2 = g * g; p2 = g * (2. / p2 - 1.); p2 = p2 * p2; + { + // Force floating-point computations done on 80 bit on + // i386 to go back to 64 bit. This is to avoid the test failures + // of https://github.com/OSGeo/PROJ/issues/1906#issuecomment-583168348 + // The choice of p2 is completely arbitrary. + volatile double p2_tmp = p2; + p2 = p2_tmp; + } xy.x = g - p2; g = p2 + al2; xy.x = M_PI * (al * xy.x + sqrt(al2 * xy.x * xy.x - g * (g2 - p2))) / g; if (lp.lam < 0.) xy.x = -xy.x; @@ -81,7 +89,7 @@ static PJ_LP vandg_s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, invers m = 2. * sqrt(-THIRD * al); d = C2_27 * c2 * c2 * c2 + (c0 * c0 - THIRD * c2 * c1) / c3; const double al_mul_m = al * m; - if( al_mul_m == 0 ) { + if( fabs(al_mul_m) < 1e-16 ) { proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION); return proj_coord_error().lp; } |
