FUNCTIONS CORE

PV()

Calculate the present value of future capital, based on periodic investments

Syntax

Signature
PV( nInvestment, nInterestRate, nPeriods ) --> nPresentValue

Arguments

nInvestment

nInterestRate

nPeriods

Example

PV.prg
PROCEDURE Main()

   LOCAL nMonthlyRate := 0.095 / 12

   Check( 'Round( PV( 175, nMonthlyRate, 24 ), 2 ) ', Round( PV( 175, nMonthlyRate, 24 ), 2 ), 3811.43 )
   Check( 'Round( PV( 175, 0.095, 2 ), 2 )         ', Round( PV( 175, 0.095, 2 ), 2 ), 305.77 )
   Check( 'PV( 100, 0, 12 )                        ', PV( 100, 0, 12 ), 1200 )

RETURN

STATIC PROCEDURE Check( cTitle, xResult, xExpected )

   QOut( cTitle + IIF( xResult == xExpected, "OK", "ERROR" ) )

RETURN

Output

Round( PV( 175, nMonthlyRate, 24 ), 2 ) OK
Round( PV( 175, 0.095, 2 ), 2 )         OK
PV( 100, 0, 12 )                        OK