Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
84441: ppc64le - fix geoindex/TestS2GeometryIndexBasic failure r=otan a=prashantkhoje

Related cockroachdb#82456
Release note: None

Co-authored-by: Prashant Khoje <[email protected]>
  • Loading branch information
craig[bot] and prashantkhoje committed Jul 17, 2022
2 parents e4cafeb + 00734a8 commit dc382b1
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 dc382b1

Please sign in to comment.