IMath.SumSqD

Fore Syntax

SumSqD(Values: Array): Decimal;

Fore.NET Syntax

SumSqD(Values: System.Array): decimal;

Parameters

Values. Array of high-precision decimal numbers.

Description

The SumSqD method returns the sum of squares of high-precision decimal numbers.

Comments

It is required to use an array of value of the Variant type.

The function works correctly with both one-dimension and two-dimension arrays.

Use the IMath.SumD method to get the sum of elements of higher accuracy decimal number array.

Fore Example

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

Sub UserProc;
Var
    r: Decimal;
    Arr: Array[4Of Variant;
Begin
    Arr[0] := -5m;
    Arr[1] := 15.08m;
    Arr[2] := 30.12m;
    Arr[3] := 5.94m;
    r := Math.SumSqD(Arr);
    Debug.WriteLine(r);
End Sub UserProc;

After executing the example the console window displays the sum of array element squares equal to 1194.9044.

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: Decimal;
    Math: MathClass = New MathClass();
    Arr: Array[4Of object;
Begin
    Arr[0] := -5m;
    Arr[1] := 15.08m;
    Arr[2] := 30.12m;
    Arr[3] := 5.94m;
    r := Math.SumSqD(Arr);
    System.Diagnostics.Debug.WriteLine(r);
End Sub;

See also:

IMath