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);