MedianDcml(Values: Array): Decimal;
MedianDcml(Values: System.Array): decimal;
Values. An array of decimal high-precision numbers, for which the median must be found.
The MedianDcml method returns median of the set numbers of the Decimal type.
To determine the number of the Decimal type in the array, it is necessary to write the "m" character after the value of each number. For example: 0.001m.
Median is a number which is the middle of a number set, that is, half of numbers has values greater than the median and the other half has values less than the median.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
st: Statistics;
a: Array[4] Of Variant;
s: Decimal;
Begin
st := New Statistics.Create;
a[0] := 0.858739815m;
a[1] := 0.148393423m;
a[2] := 0.537711777m;
a[3] := 0.128572578m;
s:=st.MedianDcml(a);
Debug.WriteLine("Median: " + s.ToString);
End Sub UserProc;
After executing the example the console window displays the median value.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Stat;
…
Public Shared Sub Main(Params: StartParams);
Var
st: Statistics;
a: Array[4] Of object;
s: decimal;
Begin
st := New Statistics.Create();
a[0] := 0.858739815m;
a[1] := 0.148393423m;
a[2] := 0.537711777m;
a[3] := 0.128572578m;
s:=st.MedianDcml(a);
System.Diagnostics.Debug.WriteLine("Median: " + s.ToString());
End Sub;
See also: