saferound
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

saferound

npm npm bundle size (version) npm GitHub test Coverage Status

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.

/saferound/

    Package Sidebar

    Install

    npm i saferound

    Weekly Downloads

    998

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    7.59 kB

    Total Files

    7

    Last publish

    Collaborators

    • jonasstr