public BigDecimal setScale(int val)
{
if (val == _Scale) return this;
BigInteger num = _BigIntegerNumber;
if (val > _Scale)
for (int i = 0; i < val - _Scale; i++)
num *= _BigIntegerTen;
else
for (int i = 0; i < _Scale - val; i++)
num /= _BigIntegerTen;
return new BigDecimal(num, val);
}
/// <summary> /// Creates a new decimal from a generic BigDecimal value. /// </summary> /// <param name="num">Value used for initialization.</param> public VoltDecimal(BigDecimal num) { this.Value = num.setScale(FixedScale); ValidOrThrow(this.Value); }