@Override
  public IDecimal round(final IDecimal decimal, final double layout, final int scale)
  {
	final PreciseDecimal pd = (PreciseDecimal) decimal;
	final int layoutDigits = DPU.getFractionalDigitsCount(layout);
	final int droppedDigits = pd.getFactor() - (scale + layoutDigits);
	final int layoutBase = (int) (DPU.getScale(layoutDigits) * layout);
	final int factor = pd.getFactor() - droppedDigits;
	if (droppedDigits == 0)
	{
	  if (layoutBase == 1)
	  {
		return decimal;
	  }
	  else
	  {
		return PreciseDecimal.getInstance(calculateBase(pd.getBase(), 0, 0, layoutBase), factor);
	  }
	}
	if (droppedDigits > 0)
	{
	  // truncate
	  final long base = DPU.getScaledBase(pd.getBase(), -droppedDigits);
	  if (base == 0)
	  {
		return DecimalImpl.ZERO;
	  }
	  else
	  {
		final long remainder = pd.getBase() % DPU.getScale(droppedDigits);
		// TODO consider the layout
		return PreciseDecimal.getInstance(calculateBase(base, remainder, droppedDigits, layoutBase), factor);
	  }
	}
	else
	{
	  // extend precision
	  // TODO check for limits
	  return PreciseDecimal.getInstance(pd.getBase() * DPU.getScale(-droppedDigits), factor);
	}
  }