Skip to content

Commit

Permalink
ppc64le - fix geoindex/TestS2GeometryIndexBasic failure
Browse files Browse the repository at this point in the history
Related cockroachdb#82456
Release note: None
  • Loading branch information
prashantkhoje committed Jul 15, 2022
1 parent 5aeea79 commit 00734a8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/geo/geo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 00734a8

Please sign in to comment.