bigmath v1.0.3
bigmath
arithmetic operators for arbitrary-precision numbers using bignumber.js
rather than constructing BigNumber instances from your numbers and using instance methods, this module provides the same methods as static functions.
npm install --save bigmathexample
test('BigMath', function (t) {
t.ok(BigMath, 'module is require-able')
t.equal(BigMath.add('1', '2'), '3', '1 + 2 = 3')
t.equal(BigMath.sub('1', '2'), '-1', '1 - 2 = -1')
t.equal(BigMath.mul('1', '2'), '2', '1 * 2 = 2')
t.equal(BigMath.div('1', '2'), '0.5', '1 / 2 = 0.5')
t.end()
})usage
BigMath = require('bigmath')
BigMath is an grab-bag of the following operators from bignumber.js:
(note: if the operator normally returns a BigNumber, our operator instead returns a string using .valueOf().)
absoluteValueabsceilcomparedTocmpdecimalPlacesdpdividedBydivdividedToIntegerBydivToIntequalseqfloorgreaterThangtgreaterThanOrEqualTogteisFiniteisIntegerisIntisNaNisNegativeisNegisZerolessThanltlessThanOrEqualTolteminussubmodulomodnegatednegplusaddprecisionsdroundshiftsquareRootsqrttimesmaxminmultoDigitstoExponentialtoFixedtoFormattoFractiontoJSONtoNumbertoPowerpowrandomtoPrecisiontoStringtruncatedtruncvalueOf
license
The Apache License
Copyright © 2017 Michael Williams
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.