Comparing version 0.6.0 to 0.6.1
11
index.js
@@ -295,2 +295,13 @@ try { | ||
BigNum.prime = function (bits, safe) { | ||
if ("undefined" === typeof safe) { | ||
safe = true; | ||
} | ||
// Force uint32 | ||
bits >>>= 0; | ||
return BigNum.uprime0(bits, !!safe); | ||
}; | ||
BigNum.prototype.probPrime = function (reps) { | ||
@@ -297,0 +308,0 @@ var n = this.probprime(reps || 10); |
{ | ||
"name" : "bignum", | ||
"version" : "0.6.0", | ||
"version" : "0.6.1", | ||
"description" : "Arbitrary-precision integer arithmetic using OpenSSL", | ||
@@ -5,0 +5,0 @@ "main" : "./index.js", |
@@ -14,2 +14,3 @@ var assert = require('assert'); | ||
assert.eql(Number(bignum('1e+100').toString()), 1e+100); | ||
assert.eql(bignum('1e+100').bitLength(), 333); | ||
assert.eql(Number(bignum('1.23e+45').toString()), 1.23e+45); | ||
@@ -459,2 +460,29 @@ for (var i = 0; i < 10; i++) { | ||
exports.jacobi = function () { | ||
// test case from p. 134 of D. R. Stinson | ||
var b1 = bignum('7411'); | ||
var b2 = bignum('9283'); | ||
assert.equal(b1.jacobi(b2), -1); | ||
// test case from p. 132 of D. R. Stinson | ||
b1 = bignum('6278'); | ||
b2 = bignum('9975'); | ||
assert.equal(b1.jacobi(b2), -1); | ||
// test case from p. 74 of Men. Oorsh. Vans. | ||
b1 = bignum('158'); | ||
b2 = bignum('235'); | ||
assert.equal(b1.jacobi(b2), -1); | ||
// test case from p. 216 of Kumanduri Romero | ||
b1 = bignum('4'); | ||
b2 = bignum('7'); | ||
assert.equal(b1.jacobi(b2), 1); | ||
// test case from p. 363 of K. R. Rosen | ||
b1 = bignum('68'); | ||
b2 = bignum('111'); | ||
assert.equal(b1.jacobi(b2), 1); | ||
}; | ||
if (process.argv[1] === __filename) { | ||
@@ -461,0 +489,0 @@ assert.eql = assert.deepEqual; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70938
1054
328