pv
Return the present value of an investment.
You're viewing an older version of this page (#5547). View the current version.
Interface
#include <codecogs/finance/accounting/pv.h>
using namespace Finance::Accounting;
This function calculates the present value, v_0, for a sequence of n future payouts p followed by a final payment v_n:
If rate = 0,
If rate > 0 and payments are received at the start of each period,
while for payments received at the end of each period
The code also uses an enumerated type PaymentPoint, using the following values:
- pp_EndOfPeriod = 0
- pp_StartOfPeriod = 1.
Example 1
A lady wins a $10 million lottery. The money is to be paid out at the end of each year in$500,000 payments for 20 years. The cu rrent treasury bill rate of 6% is used as the discount rate.
#include <stdio.h>
#include <codecogs/finance/accounting/pv.h>
int main(int argc, char *argv[])
{
double d = Finance::Accounting::pv(0.06, 20, 500000, 0, Finance::Accounting::pp_EndOfPeriod);
printf("The present value of the $10 million prize is: %7.2f\n", d);
return 0;
}Output:
The present value of the $10 million prize is: 5734960.61Parameters
References
http://www.vni.com/products/imsl/jmsl/v30/api/com/imsl/finance/Finance.html