Evaluates the net present value of a stream of unequal periodic cash flows, which are subject to a given discount rate.
#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.
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.
The net present value of an investment. If no result can be computed, NaN is returned.
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 ith cash flow.
In this example, imsl_f_net_present_value computes the net present value of a $10 million prize paid in 20 years ($50,000 per year) with an annual interest rate of 6%.
#include <stdio.h>
#include "imsl.h"
void 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);
}
The net present value of the $10 million prize is $5734963.00.
|
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |