npm.io
1.4.0 • Published 10 years ago

binary-op-arbitrary-precision

Licence
MIT
Version
1.4.0
Deps
3
Vulns
0
Weekly
0

binary-op-arbitrary-precision

Build Status Coverage Status Code Climate

Binary operation abstraction for core-arbitrary-precision

Install

npm i binary-op-arbitrary-precision

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.

Keywords