1 | ## BigNumber.js
|
2 |
|
3 | [![Build Status](https://secure.travis-ci.org/alexbardas/bignumber.js.png)](http://travis-ci.org/alexbardas/bignumber.js)
|
4 |
|
5 | BigNumber.js is a light javascript library for node.js and the browser, dealing
|
6 | with operations on big integers.
|
7 |
|
8 | It does one thing, implementing only the main arithmetic operations for big integers,
|
9 | but it does it `very well and very fast`.
|
10 |
|
11 | It is build with performance in mind and supports all basic arithmetic operations
|
12 | (+, -, *, /, ^, abs). Works with both positive and negative integers.
|
13 |
|
14 | Usage
|
15 |
|
16 | ```javascript
|
17 | var BigNumber = require('./index.js').n;
|
18 |
|
19 | BigNumber(5).plus(97).minus(53).plus(434).multiply(5435423).add(321453).multiply(21).div(2).pow(2)
|
20 | // 760056543044267246001
|
21 | ```
|
22 |
|
23 | ### API
|
24 |
|
25 | Supported methods: `add/plus`, `minus/subtract`, `multiply/mult`, `divide/div`, `power/pow`, `equals`,
|
26 | `lt`, `lte`, `gt`, `gte`, `isZero`, `abs`
|
27 |
|
28 | ###### Addition
|
29 | ```javascript
|
30 | BigNumber(2).plus(10); // or
|
31 | BigNumber(2).add(10);
|
32 | ```
|
33 |
|
34 | ###### Subtraction
|
35 | ```javascript
|
36 | BigNumber(2).minus(10); // or
|
37 | BigNumber(2).subtract(10);
|
38 | ```
|
39 |
|
40 | ###### Multiplication
|
41 | ```javascript
|
42 | BigNumber(2).multiply(10); // or
|
43 | BigNumber(2).mult(10);
|
44 | ```
|
45 |
|
46 | ###### Division
|
47 | ```javascript
|
48 | BigNumber(2).divide(10); // or
|
49 | BigNumber(2).div(10);
|
50 | ```
|
51 |
|
52 | ###### Power
|
53 | ```javascript
|
54 | BigNumber(2).power(10); // or
|
55 | BigNumber(2).pow(10);
|
56 | ``` |
\ | No newline at end of file |