Core arbitrary precision abstraction
npm install core-arbitrary-precision


Abstraction for core arbitrary precision functionality in
big.js,
bignumber.js,
decimal.js
and others via adapters.
npm i core-arbitrary-precision
Pending CodePen example.
- [[adapter]](https://github.com/javiercejudo/linear-bigjs-adapter) [[lib]](https://github.com/javiercejudo/linear-big.js) linear-big.js
- [[adapter]](https://github.com/javiercejudo/bigjs-adapter) [[lib]](https://github.com/MikeMcl/big.js) big.js
- [[adapter]](https://github.com/javiercejudo/bignumberjs-adapter) [[lib]](https://github.com/MikeMcl/bignumber.js) bignumber.js
- [[adapter]](https://github.com/javiercejudo/decimaljs-adapter) [[lib]](https://github.com/MikeMcl/decimal.js) decimal.js
- [[adapter]](https://github.com/javiercejudo/bigdecimal-adapter) [[lib]](https://github.com/iriscouch/bigdecimal.js) bigdecimal.js
- [[adapter]](https://github.com/javiercejudo/floating-adapter) [[lib]](https://github.com/javiercejudo/floating) floating
- [[adapter]](https://github.com/javiercejudo/linear-converter-adapter) [[lib]](https://github.com/javiercejudo/linear-converter) linear-converter
- [[adapter]](https://github.com/javiercejudo/very-simple-statistics-adapter) [[lib]](https://github.com/sumanla13a/statistics-module) statistics-module
See up to date list.
``js
var decimalFactory = require('core-arbitrary-precision');
var adapter = require('bigjs-adapter'); // See adapters section for full list
var Decimal = decimalFactory(adapter);
Decimal.getPrecision(); // => 20
Decimal.setPrecision(5);
Decimal.getPrecision(); // => 5
`
This core package has no operations, but they can be added:
`js
new Decimal('2').pow(new Decimal('3')).valueOf(); // => Error!
var Decimal = require('pow-arbitrary-precision')(Decimal);
new Decimal('2').pow(new Decimal('3')).valueOf(); // => '8'
`
`js
var decimalOne = new Decimal('1');
// with bigjs-adapter (other adapters might have differing implementations)
decimalOne.toString() === decimalOne.valueOf() === decimalOne.toJSON(); // => true
Number(decimalThird); // => 1
`
`js
var decimalOne = new Decimal('1');
var stringified = JSON.stringify(decimalOne); // => '"1"'
JSON.parse(stringified, decimalOne.reviver); // => new decimalOne('1')
``
See spec.
- arbitrary-precision: Arbitrary precision abstraction.
- linear-arbitrary-precision: Linear arbitrary precision abstraction.
- linear-converter: flexible linear converter with built in conversions for common units.
- linear-conversion: Linear conversion class for linear-converter.
- rescale: rescales a point given two scales.
- rescale-util: Rescale utilities.
- scale: scales normalised data.
- normalise: normalise data to [0, 1].