diff --git a/BigInteger.js b/BigInteger.js index c5eb715..958bf89 100644 --- a/BigInteger.js +++ b/BigInteger.js @@ -1314,6 +1314,7 @@ var bigInt = (function (undefined) { BigInteger.prototype.toString = function (radix, alphabet) { if (radix === undefined) radix = 10; + if (radix === 2 && !alphabet) return (this.sign ? "-" : "") + this.toArray(2).value.join(''); if (radix !== 10) return toBaseString(this, radix, alphabet); var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit; while (--l >= 0) {