From c4c479daec58f59a562f255986cfb2698798daef Mon Sep 17 00:00:00 2001 From: Craig Taverner Date: Sat, 10 May 2025 16:37:29 +0200 Subject: [PATCH] Fix #123425 numerical floating point edge case (#127982) --- .../geometry/utils/SpatialEnvelopeVisitorTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/geo/src/test/java/org/elasticsearch/geometry/utils/SpatialEnvelopeVisitorTests.java b/libs/geo/src/test/java/org/elasticsearch/geometry/utils/SpatialEnvelopeVisitorTests.java index 893a1700616a6..be45d31235725 100644 --- a/libs/geo/src/test/java/org/elasticsearch/geometry/utils/SpatialEnvelopeVisitorTests.java +++ b/libs/geo/src/test/java/org/elasticsearch/geometry/utils/SpatialEnvelopeVisitorTests.java @@ -134,7 +134,7 @@ public void testVisitGeoPointsWrapping() { } else { // Both positive and negative x values exist, we need to decide which way to wrap the bbox double unwrappedWidth = maxPosX - minNegX; - double wrappedWidth = (180 - minPosX) - (-180 - maxNegX); + double wrappedWidth = 360.0 + maxNegX - minPosX; if (unwrappedWidth <= wrappedWidth) { // The smaller bbox is around the front of the planet, no dateline wrapping required assertRectangleResult(i + ": " + point, result, minNegX, maxPosX, maxY, minY, false);