}
}
// Note: does not check for divide-by-zero.
public NumericValue div(final NumericValue b) {
NumericValue a = this;
Type precision = maxPrecision(a, b);
switch (precision) {
case INTEGER:
return new SesameNumericValue(a.intValue() / b.intValue());
case LONG:
return new SesameNumericValue(a.longValue() / b.longValue());
case FLOAT:
return new SesameNumericValue(a.floatValue() / b.floatValue());
case DOUBLE:
return new SesameNumericValue(a.doubleValue() / b.doubleValue());
case DECIMAL:
return new SesameNumericValue(a.decimalValue().divide(b.decimalValue()));
default:
// This shouldn't happen.
return null;
}
}