public void testPPmt() { assertEquals(-607.9248252633897, Vba.pPmt(0.10, 1, 30, 100000, 0, false)); assertEquals(-8422.451500705567, Vba.pPmt(0.10, 15, 30, 100000, 0, false)); assertEquals(-10547.13234273705, Vba.pPmt(0.10, 30, 30, 100000, 0, false)); // verify that pmt, ipmt, and ppmt add up double pmt = Vba.pmt(0.10, 30, 100000, 0, false); double ipmt = Vba.iPmt(0.10, 15, 30, 100000, 0, false); double ppmt = Vba.pPmt(0.10, 15, 30, 100000, 0, false); assertTrue(Math.abs(pmt - (ipmt + ppmt)) < 0.0000001); }
public void testIPmt() { assertEquals(-10000.0, Vba.iPmt(0.10, 1, 30, 100000, 0, false)); assertEquals(-2185.473324557822, Vba.iPmt(0.10, 15, 30, 100000, 0, false)); assertEquals(-60.79248252633988, Vba.iPmt(0.10, 30, 30, 100000, 0, false)); }