Index: src/java/org/apache/lucene/util/NumericUtils.java =================================================================== --- src/java/org/apache/lucene/util/NumericUtils.java (revision 964460) +++ src/java/org/apache/lucene/util/NumericUtils.java (working copy) @@ -447,7 +447,10 @@ nextMinBound = (hasLower ? (minBound + diff) : minBound) & ~mask, nextMaxBound = (hasUpper ? (maxBound - diff) : maxBound) & ~mask; - if (shift+precisionStep>=valSize || nextMinBound>nextMaxBound) { + boolean minWrap = nextMinBound < minBound; + boolean maxWrap = nextMaxBound > maxBound; + + if (shift+precisionStep>=valSize || nextMinBound>nextMaxBound || minWrap || maxWrap) { // We are in the lowest precision or the next precision is not available. addRange(builder, valSize, minBound, maxBound, shift); // exit the split recursion loop