Socket
Socket
Sign inDemoInstall

add

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.0.2

12

index.js

@@ -132,10 +132,20 @@ // The minimum machine rounding error

function dumbSum(p) {
var i, ii, sum = 0.0
for(i=0, ii=p.length; i<ii; ++i) {
sum += p[i]
}
return sum
}
function accSum(p) {
var tfmd = transform(p)
return tfmd[0] + (tfmd[1] + tfmd[2].reduce(function (a,b){return a+b}))
return tfmd[0] + (tfmd[1] +dumbSum(tfmd[2]))
}
module.exports = accSum
module.exports.dumbSum = dumbSum
module.exports.fastTwoSum = fastTwoSum
module.exports.nextPowerTwo = nextPowerTwo

4

package.json
{
"name": "add",
"version": "2.0.1",
"version": "2.0.2",
"description": "A numerically stable algorithm to add numbers accurately",

@@ -24,3 +24,3 @@ "main": "index.js",

"devDependencies": {
"tape": "^2.13.3"
"tape": "2.x.x"
},

@@ -27,0 +27,0 @@ "testling": {

@@ -29,11 +29,7 @@ /**

var i, ii, stupidAccumulate = 0
t.equal(algorithm([1,2,3,4]), 10, 'Integer sum should work')
for(i=0, ii=badVector.length; i<ii; ++i) {
stupidAccumulate += badVector[i]
}
t.equal(stupidAccumulate, 15.299999999999999, 'Inaccurate summation using naive method')
t.equal(algorithm.dumbSum(badVector), 15.299999999999999, 'Inaccurate summation using naive method')

@@ -40,0 +36,0 @@ t.equal(algorithm(badVector), 15.3, 'Rump-Ogita-Oishi summation of insidious sum')

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc