Returns the min, max, avg and total of the array or iterable. Any values that are invalid are silently skipped over.
const v = [ 10, 2, 4.2, 99 ];const mma = numbersCompute(v);// Yields: { min: 2, max: 99, total: 115.2, avg: 28.8 } Copy
const v = [ 10, 2, 4.2, 99 ];const mma = numbersCompute(v);// Yields: { min: 2, max: 99, total: 115.2, avg: 28.8 }
Use @ixfx/numbers.average, @ixfx/numbers.max, @ixfx/numbers.min or @ixfx/numers.total if you only need one of these.
A start and end range can be provided if the calculation should be restricted to a part of the input array. By default the whole array is used.
It's also possible to use an iterable as input.
import { count } from '@ixfx/numbers';numbersCompute(count(5,1)); // Averages 1,2,3,4,5 Copy
import { count } from '@ixfx/numbers';numbersCompute(count(5,1)); // Averages 1,2,3,4,5
Returns NaN if the input data is empty.
NaN
Allows restriction of range that is examined
{min, max, avg, total}
Returns the min, max, avg and total of the array or iterable. Any values that are invalid are silently skipped over.
Use @ixfx/numbers.average, @ixfx/numbers.max, @ixfx/numbers.min or @ixfx/numers.total if you only need one of these.
A start and end range can be provided if the calculation should be restricted to a part of the input array. By default the whole array is used.
It's also possible to use an iterable as input.
Returns
NaN
if the input data is empty.