Merge pull request #429 from ryanxcharles/feature/update-bn.js

update bn.js to latest version
This commit is contained in:
Ryan X. Charles 2014-07-16 16:23:53 -07:00
commit fc7b5b11c7
3 changed files with 8 additions and 3 deletions

View File

@ -4,8 +4,6 @@ var bnjs = function bnjs_extended(n) {
if (!(this instanceof bnjs_extended)) {
return new bnjs(n);
}
if (typeof n === 'number')
n = n.toString();
arguments[0] = n;
return _bnjs.apply(this, arguments);
};

View File

@ -64,7 +64,7 @@
"mocha": ">=1.15.1",
"sjcl": "=1.0.1",
"hash.js": "=0.3.1",
"bn.js": "=0.13.2",
"bn.js": "=0.13.3",
"elliptic": "=0.15.7",
"bindings": "=1.1.1",
"bufferput": "git://github.com/bitpay/node-bufferput.git",

View File

@ -17,6 +17,13 @@ describe('Bignum', function() {
var bn = new Bignum(999970000);
bn.toString().should.equal('999970000');
});
it('should parse numbers below and at bn.js internal word size', function() {
var bn = new Bignum(Math.pow(2, 26) - 1);
bn.toString().should.equal((Math.pow(2, 26) - 1).toString());
var bn = new Bignum(Math.pow(2, 26));
bn.toString().should.equal((Math.pow(2, 26)).toString());
});
describe('#add', function() {