Difference between revisions of "TIAMedian"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function TIAMedian(const TIA: TIntArray): Extended; </source> ==Availability== SCAR Divi 3.38 > Current ==Description== Ret...")
 
(Examples)
 
Line 17: Line 17:
  
 
begin
 
begin
   TIA := [1, 1, 4, 5, 5];
+
   TIA := [1, 5, 4, 1, 5];
 
   WriteLn(TIAMedian(TIA));
 
   WriteLn(TIAMedian(TIA));
 
end.
 
end.
Line 30: Line 30:
  
 
begin
 
begin
   TIA := [1, 1, 4, 5];
+
   TIA := [1, 4, 1, 5];
 
   WriteLn(TIAMedian(TIA));
 
   WriteLn(TIAMedian(TIA));
 
end.
 
end.

Latest revision as of 16:24, 12 December 2012

Definition

function TIAMedian(const TIA: TIntArray): Extended;

Availability

SCAR Divi 3.38 > Current

Description

Returns the statistical median of the integer values in the given TIntArray TIA. Throws an exception if TIA is empty.

Examples

Example 1

var
  TIA: TIntArray;

begin
  TIA := [1, 5, 4, 1, 5];
  WriteLn(TIAMedian(TIA));
end.

Output:

4

Example 2

var
  TIA: TIntArray;

begin
  TIA := [1, 4, 1, 5];
  WriteLn(TIAMedian(TIA));
end.

Output:

2.5

See Also