Made numeric range index handle value.log() properly when value is 0 or negative.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@436 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
a0d8c385f9
commit
dff870519e
@ -71,13 +71,16 @@ public class ExpressionNumericRowBinner implements RowVisitor {
|
||||
errorCount++;
|
||||
} else if (ExpressionUtils.isNonBlankData(value)) {
|
||||
if (value instanceof Number) {
|
||||
numericCount++;
|
||||
|
||||
double d = ((Number) value).doubleValue();
|
||||
|
||||
int bin = (int) Math.floor((d - _index.getMin()) / _index.getStep());
|
||||
|
||||
bins[bin]++;
|
||||
if (!Double.isInfinite(d) && !Double.isNaN(d)) {
|
||||
numericCount++;
|
||||
|
||||
int bin = (int) Math.floor((d - _index.getMin()) / _index.getStep());
|
||||
|
||||
bins[bin]++;
|
||||
} else {
|
||||
errorCount++;
|
||||
}
|
||||
} else {
|
||||
nonNumericCount++;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public class NumericBinIndex {
|
||||
}
|
||||
|
||||
protected void processValue(double v, List<Double> allValues) {
|
||||
if (!Double.isInfinite(v)) {
|
||||
if (!Double.isInfinite(v) && !Double.isNaN(v)) {
|
||||
_min = Math.min(_min, v);
|
||||
_max = Math.max(_max, v);
|
||||
allValues.add(v);
|
||||
|
@ -76,7 +76,12 @@ abstract public class ExpressionNumberComparisonRowFilter implements RowFilter {
|
||||
return _selectError;
|
||||
} else if (ExpressionUtils.isNonBlankData(v)) {
|
||||
if (v instanceof Number) {
|
||||
return _selectNumeric && checkValue(((Number) v).doubleValue());
|
||||
double d = ((Number) v).doubleValue();
|
||||
if (Double.isInfinite(d) || Double.isNaN(d)) {
|
||||
return _selectError;
|
||||
} else {
|
||||
return _selectNumeric && checkValue(d);
|
||||
}
|
||||
} else {
|
||||
return _selectNonNumeric;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user