toofast
Version:
The Node.js performance testing tool with unit-test-like API.
27 lines (26 loc) • 669 B
TypeScript
/**
* An add operation sum that significantly reduces the numerical error in the total obtained by adding a
* sequence of finite-precision floating-point numbers.
*
* @see {@link https://en.wikipedia.org/wiki/Kahan_summation_algorithm Kahan summation algorithm}
*/
export declare class Adder {
/**
* The accumulated sum.
*/
private _sum;
/**
* A running compensation for lost low-order bits.
*/
private _compensation;
/**
* The total sum of added measurements.
*/
get sum(): number;
/**
* Adds a new value to a sum.
*
* @param value The value to add.
*/
add(value: number): void;
}