robust-sum
Evaluates the sum of two nonoverlapping increasing sequences of floats
npm install robust-sum
Want to see pretty graphs? Log in now!
1 | downloads in the last day |
12 | downloads in the last week |
37 | downloads in the last month |
Last Published By | |
---|---|
Version | 0.0.3 last updated 6 months ago |
License | MIT |
Keywords | robust, sum, float, exact, nonoverlapping, shewchuk |
Repository | git://github.com/mikolalysenko/robust-sum.git (git) |
Bugs | https://github.com/mikolalysenko/robust-sum/issues |
Dependencies | two-sum, binary-merge |
Dependents (14) | compare-angle, left-right, mikolalysenko-hoarders, planar-graph-to-polyline, robust-determinant, robust-determinant-2, robust-determinant-3, robust-determinant-4, robust-dot-product, robust-in-sphere, robust-orientation, robust-product, robust-subtract, split-polygon |
robust-sum
Computes the sum of two increasing non-overlapping sequences of floats as an increasing non-overlapping sequence. This can be used to perform exact arithmetic calculations on floating point values.
Install
npm install robust-sum
Example
var robustSum = require("robust-sum")
var seq = robustSum([1, 64], [1e-64, 1e64])
console.log("result = ", seq)
API
require("robust-sum")(a, b[, result])
Computes the sum of two non-overlapping increasing sequences of floats exactly as a non-overlapping increasing sequence of floats.
a
is a non-overlapping sequence of floats that is increasing in magnitudeb
is a non-overlapping sequence of floats that is increasing magnituderesult
is an array that gets the result of summinga
andb
Returns A non-overlapping increasing sequence that encodes the result of a+b
Credits
Based on JRS' robust geometric predicates for floating point arithmetic.
Implementation (c) 2013 Mikola Lysenko. MIT License