MCPcopy Create free account
hub / github.com/d3/d3-array / add

Method add

src/fsum.js:7–20  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

5 this._n = 0;
6 }
7 add(x) {
8 const p = this._partials;
9 let i = 0;
10 for (let j = 0; j < this._n && j < 32; j++) {
11 const y = p[j],
12 hi = x + y,
13 lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
14 if (lo) p[i++] = lo;
15 x = hi;
16 }
17 p[i] = x;
18 this._n = i + 1;
19 return this;
20 }
21 valueOf() {
22 const p = this._partials;
23 let n = this._n, x, y, lo, hi = 0;

Callers 6

fsumFunction · 0.95
fcumsumFunction · 0.95
fsum-test.jsFile · 0.80
disjointFunction · 0.80
unionFunction · 0.80
supersetFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected