1.0.3 • Published 7 years ago

bigmath v1.0.3

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
7 years ago

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 bigmath

example

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().)

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.0

Unless 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.

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago