binary-op-arbitrary-precision
v1.4.0
Published
Binary operation abstraction for core-arbitrary-precision
Downloads
109
Maintainers
Readme
binary-op-arbitrary-precision
Binary operation abstraction for core-arbitrary-precision
Install
npm i binary-op-arbitrary-precision
Adapters
- See adapters
Usage
var adapter = require('floating-adapter');
var Decimal = require('core-arbitrary-precision')(adapter);
var binaryOpFactory = require('binary-op-arbitrary-precision');
Decimal = binaryOpFactory(Decimal, 'plus');
Decimal = binaryOpFactory(Decimal, 'plus', '+');
new Decimal('2').plus(new Decimal('3')).valueOf(); // => 5
new Decimal('2')['+'](new Decimal('3')).valueOf(); // => 5
See spec.