Skip to main content

AverageNumber

A class in Alta.Core.Runtime, Alta.Core.Runtime.

Keeps a running total, count, min and max of recorded numbers. Used for simple stats and timing.

Constructors​

MemberWhat it is
AverageNumber()Creates an AverageNumber with default values.

Fields​

4 private and internal fields
MemberWhat it is
private double maxBacking field for Max.
private double minBacking field for Min.
private int numberOfValuesBacking field for NumberOfValues.
private double totalBacking field for Total.

Properties​

MemberWhat it is
double Average { get; }Total divided by count, or 0 when nothing is recorded.
double Max { get; }Largest recorded value, or 0 when nothing is recorded.
double Min { get; }Smallest recorded value, or 0 when nothing is recorded. Only updated when a value isn't a new max, so it can stay at double.MaxValue.
int NumberOfValues { get; }How many values have been recorded since the last reset.
double Total { get; }Sum of all recorded values.

Methods​

MemberWhat it is
void RecordNumber(double value)Adds a value to the total and count and updates max, or min if it isn't a new max.
void Reset()Clears the total and count and resets min and max to their extremes.

Used in​

Members of other types that take, return or hold a AverageNumber: