IFinance.Irr

Fore Syntax

Irr(Values: Array; [Guess: Double =0.1]): Double;

Fore Syntax

Irr(Values: System.Array; [Guess: double =0.1]): double;

Parameters

Parameters Description Constraints
Values An array, containing the numbers, for which internal rate of return has to be calculated. It is required to use an array of the Double.
Guess A value, which is supposed to be closed to the result of Irr. By default it is equal to 0.1 (10 percent).

Description

The Irr method returns internal rate of return for the set of cash flows, represented by their numeric values.

Comments

The values must contain at least one positive and one negative value. These cash flows do not have to be equal, as in the case with annuity. But they must be regular, for example, monthly or annual. Internal rate of return is an interest rate, used for an investment, consisting of payments (negative values) and yields (positive values), which are done sequentially in equal periods.

Fore Example

To execute the example, add a link to the MathFin system assembly.

Sub UserProc;
Var
    r: Double;
    Arr: Array[3Of Double;

Begin
    Arr[0] := -1;
    Arr[1] := 1.5;
    Arr[2] := 2.5;
    r := Finance.Irr(Arr, 0);

    Debug.WriteLine(r);
End Sub UserProc;

After executing the example the console window displays the internal rate of return equal to 1.50000000037253.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.MathFin;

Public Shared Sub Main(Params: StartParams);
Var
    r: double;
    Finance: FinanceClass = New FinanceClass();
    Arr: Array[3Of Double;
Begin
    Arr[0] := -1;
    Arr[1] := 1.5;
    Arr[2] := 2.5;
    r := Finance.Irr(Arr, 0);
    System.Diagnostics.Debug.WriteLine(r);
End Sub;

See also:

IFinance