LUCENE-7185: handle underflow

This commit is contained in:
Robert Muir 2016-04-18 09:15:04 -04:00
parent 730a04723f
commit cc099d8fc6
1 changed files with 4 additions and 0 deletions

View File

@ -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);