Class Avg
- Namespace
- Albatross.Expression.Prefix
- Assembly
- Albatross.Expression.dll
Prefix expression that calculates the arithmetic average of multiple numeric operands. Takes zero or more parameters and returns their mean value.
public class Avg : PrefixExpression, IPrefixExpression, IExpression, IToken
- Inheritance
-
Avg
- Implements
- Inherited Members
- Extension Methods
Constructors
Avg()
Initializes a new instance of the Avg class with name "Avg" and variable parameter count (minimum 0).
public Avg()
Methods
Run(List<object>)
Calculates the arithmetic average of all numeric operands. Each operand is converted to double, summed, and divided by the count. Returns NaN if no operands provided.
protected override object Run(List<object> items)
Parameters
Returns
- object
The arithmetic mean of all operands as a double, or NaN for empty lists.
Exceptions
- FormatException
Thrown when any operand cannot be converted to a numeric value.
- DivideByZeroException
May return NaN when dividing by zero operands.