|
|
@ -85,28 +85,22 @@ function decorate(name) { |
|
|
|
bnjs.prototype[name] = f; |
|
|
|
}; |
|
|
|
|
|
|
|
_bnjs.prototype.gt = function(b) { |
|
|
|
return this.cmp(b) > 0; |
|
|
|
}; |
|
|
|
|
|
|
|
_bnjs.prototype.lt = function(b) { |
|
|
|
return this.cmp(b) < 0; |
|
|
|
}; |
|
|
|
|
|
|
|
decorate('add'); |
|
|
|
decorate('sub'); |
|
|
|
decorate('mul'); |
|
|
|
decorate('mod'); |
|
|
|
decorate('div'); |
|
|
|
decorate('cmp'); |
|
|
|
|
|
|
|
bnjs.prototype.gt = function(b) { |
|
|
|
if (typeof b === 'string') |
|
|
|
b = new _bnjs(b); |
|
|
|
else if (typeof b === 'number') |
|
|
|
b = new _bnjs(b.toString()); |
|
|
|
return this.cmp(b) > 0; |
|
|
|
}; |
|
|
|
|
|
|
|
bnjs.prototype.lt = function(b) { |
|
|
|
if (typeof b === 'string') |
|
|
|
b = new _bnjs(b); |
|
|
|
else if (typeof b === 'number') |
|
|
|
b = new _bnjs(b.toString()); |
|
|
|
return this.cmp(b) < 0; |
|
|
|
}; |
|
|
|
decorate('gt'); |
|
|
|
decorate('lt'); |
|
|
|
|
|
|
|
bnjs.prototype.toNumber = function() { |
|
|
|
return parseInt(this['toString'](10), 10); |
|
|
|