Skip to content

@saehrimnir/druidjs / neumair_sum

Function: neumair_sum()

ts
function neumair_sum(summands: number[] | Float64Array<ArrayBufferLike>): number;

Defined in: numerical/neumair_sum.js:14

Numerical stable summation with the Neumair summation algorithm.

Deliberately not WASM accelerated: the compensation term makes each step depend on the previous one, so the kernel cannot vectorise, and it measured slower than this loop at every input size — the argument copy is pure overhead. A neumair_sum_f64 kernel existed on that basis alone, never called by anything; it and its benchmark row were removed once the measurement had been made.

Parameters

ParameterTypeDescription
summandsnumber[] | Float64Array<ArrayBufferLike>Array of values to sum up.

Returns

number

The sum.

See

https://en.wikipedia.org/wiki/Kahan_summation_algorithm#Further_enhancements