Skip to content

Commit

Permalink
What is nil ?
Browse files Browse the repository at this point in the history
  • Loading branch information
flashultra committed Dec 14, 2024
1 parent 6b634a2 commit 0589e3d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
9 changes: 1 addition & 8 deletions std/haxe/math/bigint/BigInt_.hx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class BigInt_ {
/**
Retrieve the sign value of this big integer; 0 if positive, -1 if negative.
**/
public #if (!lua) inline #end function sign():Int {
public inline function sign():Int {
return (m_data.get(m_count - 1) >> 31 != 0) ? -1 : 0;
}

Expand Down Expand Up @@ -443,10 +443,6 @@ class BigInt_ {

/* hac 14.61, pp. 608 */
public function modInverse(modulus:BigInt_):BigInt_ {
#if (lua)
trace("moduluse: "+toString1(modulus,10));
trace("this: "+toString1(this,10));
#end
if (modulus.sign() == -1 || modulus.isZero())
throw new BigIntException(BigIntError.NEGATIVE_MODULUS);
if (equals2Int(modulus, 1))
Expand All @@ -469,9 +465,6 @@ class BigInt_ {

if (!isModulusEven) {
// fast odd calculation
#if (lua)
trace("odd calculation");
#end
return modInverseOdd(x, y);
}

Expand Down
13 changes: 11 additions & 2 deletions tests/unit/src/unit/TestBigInt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2632,12 +2632,18 @@ class TestBigInt extends Test {

public function testPrimeNumber():Void
{
#if lua
trace("testPrimeNumber");
#end
for(i in 0...s_primeNumbers.length) {
var b:BigInt = s_primeNumbers[i];
var bm:MutableBigInt = s_primeNumbers[i];
t(b.isProbablePrime(10));
t(bm.isProbablePrime(10));
}
#if lua
trace("s_notPrimeNumbers");
#end
for(i in 0...s_notPrimeNumbers.length) {
var b:BigInt = s_notPrimeNumbers[i];
var bm:MutableBigInt = s_notPrimeNumbers[i];
Expand Down Expand Up @@ -2749,10 +2755,13 @@ class TestBigInt extends Test {

public function testNextProbablePrime():Void
{
#if lua
trace("testNextProbablePrime");
#end
var a:BigInt;
a = "8329132432461";
#if lua
trace("a: "+a);
trace("a: "+(a==null));
#end
eq("8329132432469",a.nextProbablePrime().toString());
a = 269234;
Expand Down Expand Up @@ -2802,7 +2811,7 @@ class TestBigInt extends Test {
#if lua
trace("testBigIntRandomPrime");
#end
var randomPrimeNumber = BigInt.randomPrime(5,5);
var randomPrimeNumber:BigInt = BigInt.randomPrime(5,5);
#if (php || python || lua) trace("randomPrimeNumber(5): " + randomPrimeNumber); #end
t(randomPrimeNumber.isProbablePrime(5));
randomPrimeNumber = BigInt.randomPrime(11,5);
Expand Down

0 comments on commit 0589e3d

Please sign in to comment.