SumD(Values: Array): Decimal;
SumD(Values: System.Array): decimal;
Values. Array of high-precision decimal numbers.
The SumD method returns the sum of high-precision decimal numbers of the specified array.
It is required to use an array of value of the Variant.
The function works correctly with both one-dimension and two-dimension arrays.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
r: Decimal;
Arr: Array[4] Of Variant;
Begin
Arr[0] := -5m;
Arr[1] := 15.1524m;
Arr[2] := 30.65m;
Arr[3] := 5.12m;
r := math.SumD(Arr);
Debug.WriteLine(r);
End Sub UserProc;
After executing the example the console window displays the sum of array elements equal to 45.9224.
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: decimal;
Math: MathClass = New MathClass();
Arr: Array[4] Of object;
Begin
Arr[0] := -5m;
Arr[1] := 15.1524m;
Arr[2] := 30.65m;
Arr[3] := 5.12m;
r := math.SumD(Arr);
System.Diagnostics.Debug.WriteLine(r);
End Sub;
See also: