|
|
(One intermediate revision by the same user not shown) |
Line 1: |
Line 1: |
− | ==Definition==
| + | #REDIRECT [[TEAMean]] |
− | <source lang="scar" lines="false">
| |
− | function Average(Values: TExtendedArray): Extended;
| |
− | </source>
| |
| | | |
− | ===Source Code===
| + | [[Category:Deprecated Functions]] |
− | <source lang="scar">
| |
− | function Average(Values: TExtendedArray): Extended;
| |
− | var
| |
− | i, l: Integer;
| |
− | begin
| |
− | Result := 0;
| |
− | l := Length(Values);
| |
− | if l = 0 then Exit;
| |
− | for i := 0 to l - 1 do
| |
− | Result := Result + Values[i];
| |
− | Result := Result / l;
| |
− | end;
| |
− | </source>
| |
− | | |
− | ==Availability==
| |
− | SCAR Divi 3.20 > Current
| |
− | | |
− | ==Description==
| |
− | Calculates the [http://mathworld.wolfram.com/ArithmeticMean.html arithmetic mean] of a given set of [[extended]] floating point values specified by the [[TExtendedArray]] '''Values'''.
| |
− | | |
− | ==Example==
| |
− | <source lang="scar">
| |
− | var
| |
− | Values: array of Extended;
| |
− | begin
| |
− | Values := [1.2, 1.9, 2.9, 5.55, 8.69];
| |
− | WriteLn(Average(Values));
| |
− | end.
| |
− | </source>
| |
− | | |
− | Output:
| |
− | 4,048
| |
− | | |
− | [[Category:Functions]]
| |
− | [[Category:Math Functions]] | |