aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-02-18 22:50:16 +0100
committerEven Rouault <even.rouault@spatialys.com>2019-02-18 22:50:16 +0100
commit2b1cf12bf36e536cd29994951b46f180e81e1179 (patch)
tree9e49a7b998f27b5a11bff304461baa836212420a
parent97016c7f7b74bd473c446ee128d1774209eddfc0 (diff)
downloadPROJ-2b1cf12bf36e536cd29994951b46f180e81e1179.tar.gz
PROJ-2b1cf12bf36e536cd29994951b46f180e81e1179.zip
Fix a few issues with i386 builds
Relax tolerances in a few unit test, and in laea code. Seen with gcc 5.3 and also 7.1 Related to the use of the 387 floating-point math, since they disappear with gcc 7.1 if using non-default -mfpmath=sse -msse
-rw-r--r--src/iso19111/io.cpp6
-rw-r--r--src/projections/laea.cpp2
-rw-r--r--test/gie/builtins.gie7
-rw-r--r--test/unit/gie_self_tests.cpp15
-rw-r--r--test/unit/pj_phi2_test.cpp4
-rw-r--r--test/unit/test_io.cpp2
6 files changed, 19 insertions, 17 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index 6edce579..e14239b0 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -6920,7 +6920,11 @@ CRSNNPtr PROJStringParser::Private::buildProjectedCRS(
const auto &lat_2 = getParamValue(step, "lat_2");
const auto &k = getParamValueK(step);
if (lat_2.empty() && !lat_0.empty() && !lat_1.empty() &&
- getAngularValue(lat_0) == getAngularValue(lat_1)) {
+ (lat_0 == lat_1 ||
+ // For some reason with gcc 5.3.1-14ubuntu2 32bit, the following
+ // comparison returns false even if lat_0 == lat_1. Smells like
+ // a compiler bug
+ getAngularValue(lat_0) == getAngularValue(lat_1))) {
mapping = getMapping(EPSG_CODE_METHOD_LAMBERT_CONIC_CONFORMAL_1SP);
} else if (!k.empty() && getNumericValue(k) != 1.0) {
mapping = getMapping(
diff --git a/src/projections/laea.cpp b/src/projections/laea.cpp
index e3c7248a..22fb1691 100644
--- a/src/projections/laea.cpp
+++ b/src/projections/laea.cpp
@@ -82,7 +82,7 @@ eqcon:
break;
case N_POLE:
case S_POLE:
- if (q >= 0.) {
+ if (q >= 1e-15) {
b = sqrt(q);
xy.x = b * sinlam;
xy.y = coslam * (Q->mode == S_POLE ? b : -b);
diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie
index 930ca71f..37bdfc69 100644
--- a/test/gie/builtins.gie
+++ b/test/gie/builtins.gie
@@ -897,7 +897,7 @@ Chamberlin Trimetric
-------------------------------------------------------------------------------
operation +proj=chamb +R=6400000 +lat_1=0.5 +lat_2=2
-------------------------------------------------------------------------------
-tolerance 0.5 mm
+tolerance 2.5 mm
accept 2 1
expect -27864.779586801 -223364.324593274
accept 2 -1
@@ -5236,12 +5236,9 @@ van der Grinten (I)
-------------------------------------------------------------------------------
operation +proj=vandg +a=6400000 +lat_1=0.5 +lat_2=2
-------------------------------------------------------------------------------
-tolerance 0.1 mm
+tolerance 0.15 mm
accept 2 1
expect 223395.249543407 111704.596633675
-rem 223395.249543407 111704.596633675 osgeo
-rem 223395.249543407 111704.596633675 debug/bin
-
accept 2 -1
expect 223395.249543407 -111704.596633675
diff --git a/test/unit/gie_self_tests.cpp b/test/unit/gie_self_tests.cpp
index 5936791e..ad637786 100644
--- a/test/unit/gie_self_tests.cpp
+++ b/test/unit/gie_self_tests.cpp
@@ -256,8 +256,8 @@ TEST_F(gieTest, proj_create_crs_to_crs) {
b.xy.y = 5999669.3036037628;
a = proj_trans(P, PJ_FWD, a);
- EXPECT_NEAR(a.xy.x, b.xy.x, 1e-9);
- EXPECT_NEAR(a.xy.y, b.xy.y, 1e-9);
+ EXPECT_NEAR(a.xy.x, b.xy.x, 1e-8);
+ EXPECT_NEAR(a.xy.y, b.xy.y, 1e-8);
auto src = proj_get_source_crs(PJ_DEFAULT_CTX, P);
ASSERT_TRUE(src != nullptr);
@@ -419,11 +419,12 @@ TEST(gie, info_functions) {
ASSERT_FALSE(proj_errno(P)); /* factors not created correctly */
/* check a few key characteristics of the Mercator projection */
- ASSERT_EQ(factors.angular_distortion,
- 0.0); /* angular distortion should be 0 */
- ASSERT_EQ(factors.meridian_parallel_angle,
- M_PI_2); /* Meridian/parallel angle should be 90 deg */
- ASSERT_EQ(factors.meridian_convergence,
+ EXPECT_NEAR(factors.angular_distortion, 0.0, 1e-7)
+ << factors.angular_distortion; /* angular distortion should be 0 */
+ EXPECT_NEAR(factors.meridian_parallel_angle, M_PI_2, 1e-7)
+ << factors.meridian_parallel_angle; /* Meridian/parallel angle should be
+ 90 deg */
+ EXPECT_EQ(factors.meridian_convergence,
0.0); /* meridian convergence should be 0 */
proj_destroy(P);
diff --git a/test/unit/pj_phi2_test.cpp b/test/unit/pj_phi2_test.cpp
index 5fc84600..c4db6e52 100644
--- a/test/unit/pj_phi2_test.cpp
+++ b/test/unit/pj_phi2_test.cpp
@@ -41,12 +41,12 @@ TEST(PjPhi2Test, Basic) {
EXPECT_DOUBLE_EQ(M_PI_2, pj_phi2(ctx, 0.0, 0.0));
- EXPECT_DOUBLE_EQ(0.0, pj_phi2(ctx, 1.0, 0.0));
+ EXPECT_NEAR(0.0, pj_phi2(ctx, 1.0, 0.0), 1e-16);
EXPECT_DOUBLE_EQ(M_PI_2, pj_phi2(ctx, 0.0, 1.0));
EXPECT_DOUBLE_EQ(M_PI, pj_phi2(ctx, -1.0, 0.0));
EXPECT_DOUBLE_EQ(M_PI_2, pj_phi2(ctx, 0.0, -1.0));
- EXPECT_DOUBLE_EQ(0.0, pj_phi2(ctx, 1.0, 1.0));
+ EXPECT_NEAR(0.0, pj_phi2(ctx, 1.0, 1.0), 1e-16);
EXPECT_DOUBLE_EQ(M_PI, pj_phi2(ctx, -1.0, -1.0));
// TODO(schwehr): M_PI_4, M_PI_2, M_PI, M_E
diff --git a/test/unit/test_io.cpp b/test/unit/test_io.cpp
index 2cc05aad..3d015e0c 100644
--- a/test/unit/test_io.cpp
+++ b/test/unit/test_io.cpp
@@ -6773,7 +6773,7 @@ TEST(io, projparse_longlat_a_es) {
ASSERT_TRUE(crs != nullptr);
EXPECT_EQ(crs->ellipsoid()->semiMajorAxis().getSIValue(), 2);
auto rf = crs->ellipsoid()->computedInverseFlattening();
- EXPECT_EQ(rf, 3.4142135623730958) << rf;
+ EXPECT_NEAR(rf, 3.4142135623730958, 1e-14) << rf;
}
// ---------------------------------------------------------------------------