average: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page Average to average: Converting page titles to lowercase)
m (Text replacement - "source>" to "syntaxhighlight>")
Line 10: Line 10:
[h: av = average(num, num, ...)]
[h: av = average(num, num, ...)]
[h: av = mean(num, num, ...)]
[h: av = mean(num, num, ...)]
</source>
</syntaxhighlight>


|example=
|example=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[r: avg(1, 2, 3, 3, 10)]
[r: avg(1, 2, 3, 3, 10)]
</source>
</syntaxhighlight>
Returns 3.8
Returns 3.8
}}
}}
[[Category:Mathematical Function]]
[[Category:Mathematical Function]]

Revision as of 17:01, 14 March 2023

avg() Function

Calculates the average (or mean) of all of the numbers that are passed in. The mean is equal to the sum of all the arguments divided by the number of arguments.

Usage

<source lang="mtmacro" line> [h: av = avg(num, num, ...)] [h: av = average(num, num, ...)] [h: av = mean(num, num, ...)] </syntaxhighlight>

Example

<source lang="mtmacro" line>

[r: avg(1, 2, 3, 3, 10)] </syntaxhighlight>

Returns 3.8