saferound
v1.2.0
Published
sum-safe rounding of number-arrays
Downloads
4,411
Readme
saferound
About
saferound
is a simplified typescript adaption of the python library Iteround, a sum-safe rounding library.
The library solves the problem of rounding a list of numbers whilst preserving the sum.
Usage
import saferound from 'saferound';
const result = safeRound([4.0001, 3.2345, 3.2321, 6.4523, 5.3453, 7.3422], 0); // sum = 30
expect(result).toEqual([5, 3, 4, 6, 5, 7]); // sum = 30
License
Distributed under the MIT License. See LICENSE
for more information.