Skip to content

Commit

Permalink
For cartesian values we are even more lenient with extremely large va…
Browse files Browse the repository at this point in the history
…lues (#106014)
  • Loading branch information
craigtaverner committed Mar 6, 2024
1 parent 3816840 commit 61a5033
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,12 @@ private CentroidMatcher(double x, double y, double weight, double weightFactor)
}

private Matcher<Double> matchDouble(double value) {
if (value > 1e20 || value < 1e20) {
// Very large values have floating point errors, so instead of an absolute value, we use a relative one
return closeTo(value, Math.abs(value / 1e10));
} else {
// Most data (notably geo data) has values within bounds, and an absolute delta makes more sense.
return closeTo(value, DELTA);
}
// Very large values have floating point errors, so instead of an absolute value, we use a relative one
// Most data (notably geo data) has values within bounds, and an absolute delta makes more sense.
double delta = (value > 1e28 || value < -1e28) ? Math.abs(value / 1e6)
: (value > 1e20 || value < -1e20) ? Math.abs(value / 1e10)
: DELTA;
return closeTo(value, delta);
}

@Override
Expand Down

0 comments on commit 61a5033

Please sign in to comment.