Difference between revisions of "TEAMedian"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function TEAMedian(const TEA: TExtArray): Extended; </source> ==Availability== SCAR Divi 3.38 > Current ==Description== Ret...")
 
(Examples)
 
Line 17: Line 17:
  
 
begin
 
begin
   TEA := [1.1, 1.2, 4.3, 5.4, 5.5];
+
   TEA := [1.1, 5.5, 4.3, 1.2, 5.4];
 
   WriteLn(TEAMedian(TEA));
 
   WriteLn(TEAMedian(TEA));
 
end.
 
end.
Line 30: Line 30:
  
 
begin
 
begin
   TEA := [1.1, 1.2, 4.3, 5.4];
+
   TEA := [1.1, 4.3, 1.2, 5.4];
 
   WriteLn(TEAMedian(TEA));
 
   WriteLn(TEAMedian(TEA));
 
end.
 
end.

Latest revision as of 16:23, 12 December 2012

Definition

function TEAMedian(const TEA: TExtArray): Extended;

Availability

SCAR Divi 3.38 > Current

Description

Returns the statistical median of the extended values in the given TExtArray TEA. Throws an exception if TEA is empty.

Examples

Example 1

var
  TEA: TExtArray;

begin
  TEA := [1.1, 5.5, 4.3, 1.2, 5.4];
  WriteLn(TEAMedian(TEA));
end.

Output:

4.3

Example 2

var
  TEA: TExtArray;

begin
  TEA := [1.1, 4.3, 1.2, 5.4];
  WriteLn(TEAMedian(TEA));
end.

Output:

2.75

See Also