sp

sum-product

classic spreadsheet sum of array item products

Showing:

Popularity

Downloads/wk

94

GitHub Stars

0

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

sum-product

UsageTestLicense

Simple and small standalone function to calculate the sum of the product of array items. sumProduct([0,1], [2,3], [4,5]) // 0*2*4 + 1*3*5 = 15

Uses a modified Kahan sum to reduce floating point errors.

Usage

The function takes any number of arrays.

var sumProduct = require('sum-product')
var result = sumProduct([0,1], [2,3], [4,5]) //  0*2*4 + 1*3*5 = 15
result = sumProduct() //  ==>0
result = sumProduct([]) //  ==>0
result = sumProduct([a]) //  ==>NaN

License

Released under the MIT License

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial