Skip to content
Buy me a coffee

DoubleSummaryStatistics

Defined in: src/util/SummaryStatistics.ts:159

count/sum/min/max/average of doubles. The sum is compensated (Kahan), as in the reference, so long runs of small values don’t drift. Empty: min = Infinity, max = -Infinity.

new DoubleSummaryStatistics(): DoubleSummaryStatistics

Defined in: src/util/SummaryStatistics.ts:166

Creates empty statistics (count 0).

DoubleSummaryStatistics

new DoubleSummaryStatistics(count, min, max, sum): DoubleSummaryStatistics

Defined in: src/util/SummaryStatistics.ts:172

Creates statistics with the given state. With count 0 the other arguments are ignored.

number

number

number

number

DoubleSummaryStatistics

IllegalArgumentException if count < 0, or count > 0 and min > max, or count > 0 and some but not all of min, max and sum are NaN

[INSPECT](): string

Defined in: src/util/SummaryStatistics.ts:232

Node’s util.inspect hook: console.log prints the toString() form.

string


accept(value): void

Defined in: src/util/SummaryStatistics.ts:189

Records value: increments the count, adds it to the compensated sum and updates min and max (a NaN makes both NaN).

number

void


combine(other): void

Defined in: src/util/SummaryStatistics.ts:200

Merges the state of other into this one, as if every value it recorded had been recorded here.

DoubleSummaryStatistics

void

NullPointerException if other is null


getAverage(): number

Defined in: src/util/SummaryStatistics.ts:227

Returns the mean of the recorded values (compensated sum divided by count), or 0 when nothing was recorded.

number


getCount(): number

Defined in: src/util/SummaryStatistics.ts:209

Returns the number of recorded values.

number


getMax(): number

Defined in: src/util/SummaryStatistics.ts:223

Returns the largest recorded value, -Infinity when empty, or NaN if any value was NaN.

number


getMin(): number

Defined in: src/util/SummaryStatistics.ts:219

Returns the smallest recorded value, Infinity when empty, or NaN if any value was NaN.

number


getSum(): number

Defined in: src/util/SummaryStatistics.ts:214

Returns the compensated sum of the recorded values (0 when empty); NaN if any value was NaN.

number


toString(): string

Defined in: src/util/SummaryStatistics.ts:236

Returns e.g. DoubleSummaryStatistics{count=2, sum=3.000000, min=1.000000, average=1.500000, max=2.000000}.

string