Skip to content

S2LatLngRect::GetCentroid test failures #523

Open

Description

@jmr

A few years ago, the comparison threshold for rect centroid splitting was increased from 1e-15 to 2e-15.

// About 3.5% flaky with 1e-15, so increase to 2e-15, which is <0.1% flaky.
EXPECT_LE(
(r.GetCentroid() - child0.GetCentroid() - child1.GetCentroid()).Norm(),
2e-15);

Now I notice that the "full latitude range" tests sometimes fail with 1e-15 and need ~4/3 e-15.

EXPECT_NEAR(0.25 * M_PI * sin(alpha) / alpha * r.Area(),

@ericveach Do you remember if these were supposed to be rigorous, or just a small value that seemed to work?

Activity

  1. jmr commented on Jun 2, 2026

    @jmr
    MemberAuthor

    This will be fixed in the next code update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions