Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ppc64le - fix geoindex/TestS2GeometryIndexBasic failure #84441

Merged
merged 1 commit into from
Jul 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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