From 00734a88d0fd94b911b914d08fc52d881e939914 Mon Sep 17 00:00:00 2001 From: Prashant Khoje Date: Thu, 14 Jul 2022 12:57:51 -0500 Subject: [PATCH] ppc64le - fix geoindex/TestS2GeometryIndexBasic failure Related #82456 Release note: None --- pkg/geo/geo.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/geo/geo.go b/pkg/geo/geo.go index c3c6227b2be8..c59dff50abd9 100644 --- a/pkg/geo/geo.go +++ b/pkg/geo/geo.go @@ -756,9 +756,11 @@ func IsLinearRingCCW(linearRing *geom.LinearRing) bool { b := smallest c := linearRing.Coord(nextIdx) - areaSign := a.X()*b.Y() - a.Y()*b.X() + - a.Y()*c.X() - a.X()*c.Y() + - b.X()*c.Y() - c.X()*b.Y() + // Explicitly use float64 conversion to disable "fused multiply and add" (FMA) to force + // identical behavior on all platforms. See https://golang.org/ref/spec#Floating_point_operators + areaSign := float64(a.X()*b.Y()) - float64(a.Y()*b.X()) + // nolint:unconvert + float64(a.Y()*c.X()) - float64(a.X()*c.Y()) + // nolint:unconvert + float64(b.X()*c.Y()) - float64(c.X()*b.Y()) // nolint:unconvert // Note having an area sign of 0 means it is a flat polygon, which is invalid. return areaSign > 0 }