IMSL C Math Library
internal_rate_of_return
Evaluates the internal rate of return for a schedule of cash flows.
Synopsis
#include <imsl.h>
float imsl_f_internal_rate_of_return (int count, float values[], …, 0)
The type double function is imsl_d_internal_rate_of_return.
Required Arguments
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 occur at regular intervals, which includes the initial investment.
Return Value
The internal rate of return for a schedule of cash flows. If no result can be computed, NaN is returned.
Synopsis with Optional Arguments
#include <imsl.h>
float imsl_f_internal_rate_of_return (int count, float values[],
IMSL_XGUESS, float guess,
IMSL_HIGHEST, float max,
0)
Optional Arguments
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%).
Description
Function imsl_f_internal_rate_of_return computes the internal rate of return for a schedule of cash flows. The internal rate of return is the interest rate such that a stream of payments has a net present value of zero.
It is found by solving the following:
where valuei =the i-th cash flow, rate is the internal rate of return.
Example
In this example, imsl_f_internal_rate_of_return 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>
 
int main()
{
float values[] = { -4500., -800., 800., 800., 600.,
600., 800., 800., 700., 3000. };
float internal_rate;
 
internal_rate = imsl_f_internal_rate_of_return (10, values, 0);
printf ("After 9 years, the internal rate of return on the ");
printf ("cows is %.2f%%.\n", internal_rate * 100.);
}
Output
 
After 9 years, the internal rate of return on the cows is 7.21%.