1.3.0 • Published 1 year ago

round-half-even v1.3.0

Weekly downloads
646
License
MIT
Repository
github
Last release
1 year ago

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/schowdhuri/round-half-even/master/demo/index.html

Installation

Using npm:

npm install --save round-half-even

Or yarn:

yarn add round-half-even

Usage

roundHalfEven(floatingPointValue, numberOfDecimals);

Node.js

import roundHalfEven from "round-half-even";
roundHalfEven(1.435, 2); // returns 1.44

Within 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 build

or

yarn build

Run tests:

npm test

or

yarn test

MIT Licensed

1.3.0

1 year ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago