@newbish/round-half-even
v1.3.1-b
Published
A utility for tie-breaking rounding, also called Banker's Rounding or Commercial Rounding
Readme
Round Half to Even
A utility for tie-breaking rounding, also called Banker's Rounding or Commercial Rounding.
Read more: https://en.wikipedia.org/wiki/Rounding#Round_half_to_even
Demo
https://rawgit.com/newbish/round-half-even/master/demo/index.html
Installation
Using npm:
npm install --save @newbish/round-half-evenOr yarn:
yarn add @newbish/round-half-evenUsage
roundHalfEven(floatingPointValue, numberOfDecimals);Node.js
import roundHalfEven from "round-half-even";
roundHalfEven(1.435, 2); // returns 1.44Within the browser:
<script src="https://unpkg.com/round-half-even"></script>
<script>
roundHalfEven(1.435, 2); // returns 1.44
</script>Development
Make changes to src/index.js. Generate the browser-ready package:
npm run buildor
yarn buildRun tests:
npm testor
yarn test