<-- Previous || Up || Next -->

Number Periods Verify Sub
Math Financial Class

Private Sub NumberPeriodsVerify()
    'Verify that the NumberPeriods function works correctly.

    Debug.Assert Approx(NumberPeriods(0.1 / 12, 400, 18000, 0, 0), -38.3734543679762)
    Debug.Assert Approx(NumberPeriods(0.1 / 12, 400, 18000, 0, 1), -38.1015490812598)
    Debug.Assert Approx(NumberPeriods(0.1 / 12, 400, -18000, 0, 0), 56.6351122855308)
    Debug.Assert Approx(NumberPeriods(0.1 / 12, 400, -18000, 0, 1), 56.0390716221032)
    Debug.Assert Approx(NumberPeriods(0.1 / 12, -400, 18000, 0, 0), 56.6351122855308)
    Debug.Assert Approx(NumberPeriods(0.1 / 12, -400, 18000, 0, 1), 56.0390716221032)
    Debug.Assert Approx(NumberPeriods(0.1 / 12, -400, -18000, 0, 0), -38.3734543679762)
    Debug.Assert Approx(NumberPeriods(0.1 / 12, -400, -18000, 0, 1), -38.1015490812598)
    
    Debug.Assert Approx(NumberPeriods(0.1 / 12, -400, 18000, 5000, 0), 68.5754975262508)
    Debug.Assert Approx(NumberPeriods(0.1 / 12, -400, 18000, 5000, 1), 67.8854709689438)
    Debug.Assert Approx(NumberPeriods(0.1 / 12, -400, 18000, -5000, 0), 43.3800804850951)
    Debug.Assert Approx(NumberPeriods(0.1 / 12, -400, 18000, -5000, 1), 42.8997821304739)

    Debug.Assert Approx(NumberPeriods(0, 400, 18000, 0, 0), -45)
    Debug.Assert Approx(NumberPeriods(0, 400, -18000, 0, 0), 45)
    Debug.Assert Approx(NumberPeriods(0, -400, 18000, 0, 0), 45)
    Debug.Assert Approx(NumberPeriods(0, -400, -18000, 0, 0), -45)
    Debug.Assert Approx(NumberPeriods(0, -400, 18000, 5000, 0), 57.5)
    Debug.Assert Approx(NumberPeriods(0, -400, 18000, -5000, 0), 32.5)

End Sub

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.