Sub Math Financial Class

InterestRateVerify

Signature (Visual Basic / VBA)

Private Sub InterestRateVerify()
    'Verify that the InterestRate function works correctly.

    Const Epsilon = 0.0000001 ' 1E-7

    Debug.Assert Approx(InterestRate(4 * 12, -400, 18000, 0, 0), 2.66552172387516E-03, Epsilon)
    Debug.Assert Approx(InterestRate(4 * 12, -400, 18000, 0, 1), 2.78168534821876E-03, Epsilon)
    Debug.Assert Approx(InterestRate(4 * 12, 400, -18000, 0, 0), 2.66552172387951E-03, Epsilon)
    Debug.Assert Approx(InterestRate(4 * 12, 400, -18000, 0, 1), 2.78168534822339E-03, Epsilon)

End Sub