/** * Returns the value as a BigDecimal. */ public BigDecimal toBigDecimal() { return new BigDecimal(toBigInteger(), scale_); }
@Override public int compareTo(DecimalWritable o) { // Comparing the integer values is correct (fixed scale) and cheaper. // FIXME: This is not correct if the scale for the decimals is different. //assert decimal_.getScale() == o.get().getScale(); return decimal_.toBigInteger().compareTo(o.get().toBigInteger()); } }