* @see org.exist.xquery.value.NumericValue#idiv(org.exist.xquery.value.NumericValue)
*/
public ComputableValue div(ComputableValue other) throws XPathException {
if (other instanceof IntegerValue) {
if (((IntegerValue) other).isZero())
{throw new XPathException(ErrorCodes.FOAR0001, "division by zero");}
//http://www.w3.org/TR/xpath20/#mapping : numeric; but xs:decimal if both operands are xs:integer
final BigDecimal d = new BigDecimal(value);
final BigDecimal od = new BigDecimal(((IntegerValue) other).value);
final int scale = Math.max(18, Math.max(d.scale(), od.scale()));
return new DecimalValue(d.divide(od, scale, BigDecimal.ROUND_HALF_DOWN));