IMSL C Math Library
net_present_value
Evaluates the net present value of a stream of unequal periodic cash flows, which are subject to a given discount rate.
Synopsis
#include <imsl.h>
float imsl_f_net_present_value (float rate, int count, float values[])
The type double function is imsl_d_net_present_value.
Required Arguments
float rate (Input)
Interest rate per period.
int count (Input)
Number of cash flows in values.
float values[] (Input)
Array of size count of equally-spaced cash flows.
Return Value
The net present value of an investment. If no result can be computed, NaN is returned.
Description
Function imsl_f_net_present_value computes the net present value of an investment. Net present value is the current value of a stream of payments, after discounting the payments using some interest rate.
It is found by solving the following:
where valuei= the i-th cash flow.
Example
In this example, imsl_f_net_present_value computes the net present value of a $10 million prize paid in 20 years ($500,000 per year) with an annual interest rate of 6%.
 
#include <stdio.h>
#include <imsl.h>
 
int main()
{
float rate = 0.06;
int count = 20;
float value[20];
float net_present_value;
int i;
 
for (i = 0; i < count; i++)
value[i] = 500000.;
 
net_present_value = imsl_f_net_present_value (rate, count, value);
 
printf ("The net present value of the $10 million prize is $%.2f.\n",
net_present_value);
}
Output
 
The net present value of the $10 million prize is $5734963.00.