average: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Text replacement - "source>" to "syntaxhighlight>")
m (Text replacement - "<source" to "<syntaxhighlight")
Line 6: Line 6:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: av = avg(num, num, ...)]
[h: av = avg(num, num, ...)]
[h: av = average(num, num, ...)]
[h: av = average(num, num, ...)]
Line 13: Line 13:


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

Revision as of 20:39, 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

[h: av = avg(num, num, ...)]
[h: av = average(num, num, ...)]
[h: av = mean(num, num, ...)]

Example

[r: avg(1, 2, 3, 3, 10)]
Returns 3.8