You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2016/04/18 15:15:59 UTC
lucene-solr:master: LUCENE-7185: handle underflow
Repository: lucene-solr
Updated Branches:
refs/heads/master 730a04723 -> cc099d8fc
LUCENE-7185: handle underflow
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/cc099d8f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/cc099d8f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/cc099d8f
Branch: refs/heads/master
Commit: cc099d8fc60a7693417754f9b3a3f51f0952f9a3
Parents: 730a047
Author: Robert Muir <rm...@apache.org>
Authored: Mon Apr 18 09:15:04 2016 -0400
Committer: Robert Muir <rm...@apache.org>
Committed: Mon Apr 18 09:15:04 2016 -0400
----------------------------------------------------------------------
.../src/java/org/apache/lucene/geo/GeoTestUtil.java | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cc099d8f/lucene/test-framework/src/java/org/apache/lucene/geo/GeoTestUtil.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/geo/GeoTestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/geo/GeoTestUtil.java
index eb48a8f..98e2966 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/geo/GeoTestUtil.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/geo/GeoTestUtil.java
@@ -195,6 +195,10 @@ public class GeoTestUtil {
} else {
double x = nextLongitudeBetween(minX, maxX);
double y = (y1 - y2) / (x1 - x2) * (x-x1) + y1;
+ if (Double.isFinite(y) == false) {
+ // this can happen due to underflow when delta between x values is wonderfully tiny!
+ y = Math.copySign(90, x1);
+ }
double delta = (maxY - minY) * 0.01;
// our formula may put the targeted Y out of bounds
y = Math.min(90, y);