CNLMath : Special Functions : internal_rate_of_return
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,
IMSL_MAX_EVALS, int max_evals,
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: max = 1.0 (100%).
IMSL_MAX_EVALS, int max_evals (Input)
The maximum number of function evaluations allowed in the computation of the internal rate of return.
Default: max_evals = 1000.
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 equation:
where n is the number of cash flows, Ci is the i-th cash flow (including the initial investment C0), and r 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%.
Fatal Errors
IMSL_IRR_NOT_COMPUTABLE
Unable to compute the internal rate of return. Check if the sequence of total initial investment costs and cash inflows enable an internal rate of return for the given value of “max”. Use or modification of variable “guess” might also lead to better results.