Evaluates the internal rate of return for a schedule of cash flows. It is not necessary that the cash flows be periodic.
#include <imsl.h>
float
imsl_f_internal_rate_schedule (int count, float values[],
struct
tm dates[], …, 0)
The type double function is imsl_d_internal_rate_schedule.
int count
(Input)
Number of cash flows in values. count must be greater
than one.
float values[]
(Input)
Array of size count of cash flows,
which includes the initial investment.
struct tm dates[]
(Input)
Array of size count of dates cash
flows are made see the Usage
Notes section of this chapter.
The internal rate of return for a schedule of cash flows that is not necessarily periodic. If no result can be computed, NaN is returned.
#include <imsl.h>
float
imsl_f_internal_rate_schedule (int count, float values[],
struct
tm dates[], IMSL_XGUESS, float guess,
IMSL_HIGHEST,
float max, 0)
IMSL_XGUESS,
float
guess (Input)
Initial guess at the internal rate of
return.
IMSL_HIGHEST,
float
max (Input)
Maximum value of the internal rate of return
allowed.
Default: 1.0 (100%)
Function imsl_f_internal_rate_schedule computes the internal rate of return for a schedule of cash flows that is not necessarily periodic. The internal rate such that the stream of payments has a net present value of zero.
It can be found by solving the following:

In the equation above, di represents the ith payment date. d1 represents the 1st payment date. valuei represents the ith cash flow. rate is the internal rate of return.
In this example, imsl_f_internal_rate_schedule computes the internal rate of return for nine cash flows, $-800, $800, $800, $600, $600, $800, $800, $700 and $3,000, with an initial investment of $4,500.
#include <stdio.h>
#include "imsl.h"
void main()
{
float values[10] = { -4500., -800., 800., 800., 600., 600.,
800., 800., 700., 3000. };
struct tm dates[10];
float xirr;
dates[0].tm_year = 98; dates[0].tm_mon = 0; dates[0].tm_mday = 1;
dates[1].tm_year = 98; dates[1].tm_mon = 9; dates[1].tm_mday = 1;
dates[2].tm_year = 99; dates[2].tm_mon = 4; dates[2].tm_mday = 5;
dates[3].tm_year = 100; dates[3].tm_mon = 4; dates[3].tm_mday = 5;
dates[4].tm_year = 101; dates[4].tm_mon = 5; dates[4].tm_mday = 1;
dates[5].tm_year = 102; dates[5].tm_mon = 6; dates[5].tm_mday = 1;
dates[6].tm_year = 103; dates[6].tm_mon = 7; dates[6].tm_mday = 30;
dates[7].tm_year = 104; dates[7].tm_mon = 8; dates[7].tm_mday = 15;
dates[8].tm_year = 105; dates[8].tm_mon = 9; dates[8].tm_mday = 15;
dates[9].tm_year = 106; dates[9].tm_mon = 10; dates[9].tm_mday = 1;
xirr = imsl_f_internal_rate_schedule (10, values, dates, 0);
printf ("After approximately 9 years, the internal\n");
printf ("rate of return on the cows is %.2f%%.\n", xirr * 100.);
}
After approximately 9 years, the internal
rate of return on the cows is 7.69%.
|
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |