npm.io
0.3.5 • Published 12 years ago

bigintjs

Licence
MIT
Version
0.3.5
Deps
0
Vulns
0
Weekly
0
Stars
19

BigInt Build Status Image

Enables working with integers beyond 53 bits (the upper limit of what JavaScript's Number type can accurately represent).

This is a pure JavaScript library, unlike other libraries that do the same thing.

Example

var bigint = require('bigintjs');

console.log(bigint('99999999999999999999999999999').add('1').toString());
// 100000000000000000000000000000

// Bitwise operations on a big number (JavaScript only supports up to 32 bits)
var value = bigint('0xFFFFFFFFFFFFFFFF').and('0xF0F0F0F0F0F0F0F0').shiftLeft(8);

Using this package

You can install this package with NPM:

npm install --save bigintjs

To be able to run this in a browser, you need to use a framework that supports CommonJS modules (for example: Browserify).