GithubHelp home page GithubHelp logo

wangpengju / bignumber.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexbardas/bignumber.js

0.0 2.0 0.0 44 KB

Arithmetic operations on big numbers

Home Page: http://alexbardas.github.io/bignumber.js

License: MIT License

JavaScript 100.00%

bignumber.js's Introduction

BigNumber.js

Build Status

BigNumber.js is a light javascript library for node.js and the browser. It supports arithmetic operations on Big Integers.

It is build with performance in mind, uses the fastest algorithms and supports all basic arithmetic operations (+, -, *, /, %, ^, abs). Works with both positive and negative big integers.

: (http://alexbardas.github.io/bignumber.js/)

Install: npm install

Test: npm test

Usage:

  • in node:
	var BigNumber = require('big-number');

    BigNumber(5).plus(97).minus(53).plus(434).multiply(5435423).add(321453).multiply(21).div(2).pow(2);
    // 760056543044267246001
  • in the browser:
	<script src ="big-number.js"></script>

    n(5).plus(97).minus(53).plus(434).multiply(5435423).add(321453).multiply(21).div(2).pow(2);
    // 760056543044267246001

API

Supported methods: add/plus, minus/subtract, multiply/mult, divide/div, power/pow, mod, equals, lt, lte, gt, gte, isZero, abs

Addition
	BigNumber(2).plus(10); // or
	BigNumber(2).add(10);
Subtraction
	BigNumber(2).minus(10); // or
	BigNumber(2).subtract(10);
Multiplication
	BigNumber(2).multiply(10); // or
	BigNumber(2).mult(10);
Division
	BigNumber(2).divide(10); // or
	BigNumber(2).div(10);
Modulo
	BigNumber(53).mod(14);
Power
	BigNumber(2).power(10); // or
	BigNumber(2).pow(10);

bignumber.js's People

Contributors

alexbardas avatar nathsou avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.