Skip to content

➕ ➖ ❌ ➗ arithmetic operators for arbitrary-precision numbers

Notifications You must be signed in to change notification settings

ahdinosaur/bigmath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

➕ ➖ ❌ ➗ arithmetic operators for arbitrary-precision numbers

Resources

Stars

Watchers

Forks

Packages

No packages published