diff --git a/README.md b/README.md index afad1b0..5632728 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ # BigDecimal a polyfill for decimal propocal - https://github.com/tc39/proposal-decimal +It is implemented on the top of native BigInt. +It can be compiled using https://www.npmjs.com/package/babel-plugin-transform-bigint to use JSBI. # Usage: +## Installation: +`npm install @yaffle/bigdecimal` + ## Type conversion: `BigDecimal.BigDecimal(string)` @@ -54,6 +59,17 @@ a polyfill for decimal propocal - https://github.com/tc39/proposal-decimal The `rounding` argument may look like `{maximumFractionDigits: 10, roundingMode: "half-even"}` or `{maximumSignificantDigits: 10, roundingMode: "half-even"}`, where the roundingMode can be "floor", or "ceil", or "half-even", or "half-up". +## Example: +```javascript + +import BigDecimal from './node_modules/@yaffle/bigdecimal/BigDecimal.js'; + +var pi = BigDecimal.multiply(BigDecimal.BigDecimal(4), BigDecimal.atan(BigDecimal.BigDecimal(1), {maximumSignificantDigits: 1000, roundingMode: 'half-even'})); + +console.log(pi.toString()); + +``` + # Similar projects: 1. https://github.com/MikeMcl/decimal.js/ 2. https://github.com/uzyn/bigdenary diff --git a/package.json b/package.json index 4ffdc78..292f8ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yaffle/bigdecimal", - "version": "1.0.0", + "version": "1.0.2", "description": "Arbitrary precision decimal arithmetic library. Polyfill for decimal proposal. Implemented on the top of BigInt.", "main": "BigDecimal.js", "scripts": { @@ -17,10 +17,14 @@ "arithmetic", "bigdecimal" ], + "files": [ + "BigDecimal.js" + ], "author": "Viktor Mukhachev", "license": "ISC", "bugs": { "url": "https://github.com/Yaffle/BigDecimal/issues" }, - "homepage": "https://github.com/Yaffle/BigDecimal#readme" + "homepage": "https://github.com/Yaffle/BigDecimal#readme", + "type": "module" }