add
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -141,2 +141,8 @@ // The minimum machine rounding error | ||
function accSum(p) { | ||
// Zero length array, or all values are zeros | ||
if(p.length === 0 || maxAbs(p) === 0) { | ||
return 0 | ||
} | ||
var tfmd = transform(p) | ||
@@ -143,0 +149,0 @@ |
{ | ||
"name": "add", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "A cross-browser, numerically stable algorithm to add floats accurately", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -27,3 +27,3 @@ /** | ||
test('accumulate', function (t) { | ||
t.plan(4) | ||
t.plan(5) | ||
@@ -38,4 +38,6 @@ | ||
t.equal(algorithm([0]), 0, 'Rump-Ogita-Oishi summation of zero array') | ||
t.equal(algorithm([0, 0, 0]), 0, 'Rump-Ogita-Oishi summation of zero array') | ||
t.equal(algorithm([]), 0, 'Rump-Ogita-Oishi summation of empty array') | ||
}) | ||
6905
153