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:16:37 UTC
lucene-solr:branch_6x: LUCENE-7185: handle underflow
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x beca96cd3 -> 045f2cad6
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/045f2cad
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/045f2cad
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/045f2cad
Branch: refs/heads/branch_6x
Commit: 045f2cad6f7808f11a4f0626ec497a077eac3220
Parents: beca96c
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:16:21 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/045f2cad/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);