public void SubtractBigDecimal() { BigDecimal sub1 = BigDecimal.Parse("13948"); BigDecimal sub2 = BigDecimal.Parse("2839.489"); BigDecimal result = sub1.Subtract(sub2); Assert.IsTrue(result.ToString().Equals("11108.511") && result.Scale == 3, "13948 - 2839.489 is wrong: " + result); BigDecimal result2 = sub2.Subtract(sub1); Assert.IsTrue(result2.ToString().Equals("-11108.511") && result2.Scale == 3, "2839.489 - 13948 is wrong"); Assert.IsTrue(result.Equals(result2.Negate()), "13948 - 2839.489 is not the negative of 2839.489 - 13948"); sub1 = new BigDecimal(value, 1); sub2 = BigDecimal.Parse("0"); result = sub1.Subtract(sub2); Assert.IsTrue(result.Equals(sub1), "1234590.8 - 0 is wrong"); sub1 = new BigDecimal(1.234E-03); sub2 = new BigDecimal(3.423E-10); result = sub1.Subtract(sub2); Assert.IsTrue(result.ToDouble() == 0.0012339996577, "1.234E-03 - 3.423E-10 is wrong, " + result.ToDouble()); sub1 = new BigDecimal(1234.0123); sub2 = new BigDecimal(1234.0123000); result = sub1.Subtract(sub2); Assert.IsTrue(result.ToDouble() == 0.0, "1234.0123 - 1234.0123000 is wrong, " + result.ToDouble()); }