LUCENE-6873: Fix numerical precision issue in SpatialTestCase.randomGaussianMeanMax

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1725057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David Wayne Smiley 2016-01-17 04:40:30 +00:00
parent d231546a5f
commit 4fe23d03f2
1 changed files with 2 additions and 1 deletions

View File

@ -227,7 +227,8 @@ public abstract class SpatialTestCase extends LuceneTestCase {
else
pivotResult = Math.min(pivotMax, (g - 1) * (pivotMax - pivot) + pivot);
return mean + flip * pivotResult;
double result = mean + flip * pivotResult;
return (result < 0 || result > max) ? mean : result; // due this due to computational numerical precision
}
// ================================================= Inner Classes =================================================