Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename handful of BigInteger functions and deprecate get_str #22818

Merged
merged 15 commits into from
Aug 1, 2023
Merged
514 changes: 315 additions & 199 deletions modules/standard/BigInteger.chpl

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions test/deprecated/BigInteger/addSubMul.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// deprecated in 1.32 by Jade
use BigInteger;

var a: bigint = 3;
var b: bigint = 4;
var res: bigint = 11;

addmul(res, a, b);
writeln(res);
addmul(res, a, 7:int);
writeln(res);
addmul(res, a, 8:uint);
writeln(res);

submul(res, a, b);
writeln(res);
submul(res, a, 7:int);
writeln(res);
submul(res, a, 8:uint);
writeln(res);
12 changes: 12 additions & 0 deletions test/deprecated/BigInteger/addSubMul.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
addSubMul.chpl:8: warning: addmul is deprecated - please use addMul instead
addSubMul.chpl:10: warning: addmul is deprecated - please use addMul instead
addSubMul.chpl:12: warning: addmul is deprecated - please use addMul instead
addSubMul.chpl:15: warning: submul is deprecated - please use subMul instead
addSubMul.chpl:17: warning: submul is deprecated - please use subMul instead
addSubMul.chpl:19: warning: submul is deprecated - please use subMul instead
23
44
68
56
35
11
6 changes: 6 additions & 0 deletions test/deprecated/BigInteger/deprecateGet_str.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// deprecated in 1.32 by Jade
use BigInteger;

var x: bigint = 1;
var s = x.get_str();
writeln(s);
2 changes: 2 additions & 0 deletions test/deprecated/BigInteger/deprecateGet_str.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecateGet_str.chpl:5: warning: get_str is deprecated - please use a cast to a string or IO methods to get the string representation
1
18 changes: 9 additions & 9 deletions test/deprecated/BigInteger/deprecateOverwritingMethods.good
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ deprecateOverwritingMethods.chpl:n: warning: bigint.pow method is deprecated - p
deprecateOverwritingMethods.chpl:n: warning: bigint.pow method is deprecated - please use the standalone function pow
deprecateOverwritingMethods.chpl:n: warning: bigint.pow method is deprecated - please use the standalone function pow
deprecateOverwritingMethods.chpl:n: warning: bigint.root method is deprecated - please use the standalone function root
deprecateOverwritingMethods.chpl:n: warning: bigint.rootrem method is deprecated - please use the standalone function rootrem
deprecateOverwritingMethods.chpl:n: warning: bigint.rootrem method is deprecated - please use the standalone function rootRem instead
deprecateOverwritingMethods.chpl:n: warning: bigint.sqrt method is deprecated - please use the standalone function sqrt
deprecateOverwritingMethods.chpl:n: warning: bigint.sqrtrem method is deprecated - please use the standalone function sqrtrem
deprecateOverwritingMethods.chpl:n: warning: bigint.sqrtrem method is deprecated - please use the standalone function sqrtRem instead
deprecateOverwritingMethods.chpl:n: warning: bigint.nextprime method is deprecated - please use the standalone function nextPrime
deprecateOverwritingMethods.chpl:n: warning: bigint.gcd method is deprecated - please use the standalone function gcd
deprecateOverwritingMethods.chpl:n: warning: bigint.gcd method is deprecated - please use the standalone function gcd
Expand Down Expand Up @@ -39,12 +39,12 @@ deprecateOverwritingMethods.chpl:n: warning: bigint.sub method is deprecated - p
deprecateOverwritingMethods.chpl:n: warning: bigint.mul method is deprecated - please use the standalone function mul
deprecateOverwritingMethods.chpl:n: warning: bigint.mul method is deprecated - please use the standalone function mul
deprecateOverwritingMethods.chpl:n: warning: bigint.mul method is deprecated - please use the standalone function mul
deprecateOverwritingMethods.chpl:n: warning: bigint.addmul method is deprecated - please use the standalone function addmul
deprecateOverwritingMethods.chpl:n: warning: bigint.addmul method is deprecated - please use the standalone function addmul
deprecateOverwritingMethods.chpl:n: warning: bigint.addmul method is deprecated - please use the standalone function addmul
deprecateOverwritingMethods.chpl:n: warning: bigint.submul method is deprecated - please use the standalone function submul
deprecateOverwritingMethods.chpl:n: warning: bigint.submul method is deprecated - please use the standalone function submul
deprecateOverwritingMethods.chpl:n: warning: bigint.submul method is deprecated - please use the standalone function submul
deprecateOverwritingMethods.chpl:n: warning: bigint.addmul method is deprecated - please use the standalone function addMul instead
deprecateOverwritingMethods.chpl:n: warning: bigint.addmul method is deprecated - please use the standalone function addMul instead
deprecateOverwritingMethods.chpl:n: warning: bigint.addmul method is deprecated - please use the standalone function addMul instead
deprecateOverwritingMethods.chpl:n: warning: bigint.submul method is deprecated - please use the standalone function subMul instead
deprecateOverwritingMethods.chpl:n: warning: bigint.submul method is deprecated - please use the standalone function subMul instead
deprecateOverwritingMethods.chpl:n: warning: bigint.submul method is deprecated - please use the standalone function subMul instead
deprecateOverwritingMethods.chpl:n: warning: bigint.mul_2exp method is deprecated - please use the standalone function mul2Exp
deprecateOverwritingMethods.chpl:n: warning: bigint.neg method is deprecated - please use the standalone function neg
deprecateOverwritingMethods.chpl:n: warning: bigint.abs method is deprecated - please use the standalone function abs
Expand All @@ -59,7 +59,7 @@ deprecateOverwritingMethods.chpl:n: warning: bigint.divR2Exp method is deprecate
deprecateOverwritingMethods.chpl:n: warning: bigint.mod method is deprecated - please use the standalone function mod
deprecateOverwritingMethods.chpl:n: warning: bigint.mod method is deprecated - please use the standalone function mod
deprecateOverwritingMethods.chpl:n: warning: bigint.and method is deprecated - please use the standalone function and
deprecateOverwritingMethods.chpl:n: warning: bigint.ior method is deprecated - please use the standalone function ior
deprecateOverwritingMethods.chpl:n: warning: bigint.ior method is deprecated - please use the standalone function or instead
deprecateOverwritingMethods.chpl:n: warning: bigint.xor method is deprecated - please use the standalone function xor
deprecateOverwritingMethods.chpl:n: warning: bigint.com method is deprecated - please use the standalone function com

Expand Down
8 changes: 0 additions & 8 deletions test/deprecated/BigInteger/deprecateScanArg.chpl

This file was deleted.

4 changes: 0 additions & 4 deletions test/deprecated/BigInteger/deprecateScanArg.good

This file was deleted.

9 changes: 9 additions & 0 deletions test/deprecated/BigInteger/ior.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// deprecated in 1.32 by Jade
use BigInteger;

var a: bigint = 0xF0;
var b: bigint = 0x0F;
var res: bigint;

ior(res, a, b);
writeln(res);
2 changes: 2 additions & 0 deletions test/deprecated/BigInteger/ior.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ior.chpl:8: warning: ior is deprecated - please use or instead
255
8 changes: 8 additions & 0 deletions test/deprecated/BigInteger/popcount.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// deprecated in 1.32 by Jade
use BigInteger;

var a: bigint = 0b010101010101;
var n: uint;

n = a.popcount();
writeln(n);
2 changes: 2 additions & 0 deletions test/deprecated/BigInteger/popcount.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
popcount.chpl:7: warning: popcount is deprecated - please use bigint.popCount instead
6
11 changes: 11 additions & 0 deletions test/deprecated/BigInteger/rootSqrtRem.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// deprecated in 1.32 by Jade
use BigInteger;

var a: bigint = 27;
var res, rem: bigint;

rootrem(res, rem, a, 3);
writeln((res, rem));

sqrtrem(res, rem, a);
writeln((res, rem));
4 changes: 4 additions & 0 deletions test/deprecated/BigInteger/rootSqrtRem.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rootSqrtRem.chpl:7: warning: rootrem is deprecated - please use rootRem instead
rootSqrtRem.chpl:10: warning: sqrtrem is deprecated - please use sqrtRem instead
(3, 0)
(5, 2)
11 changes: 11 additions & 0 deletions test/deprecated/BigInteger/scan01.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// deprecated in 1.32 by Jade
use BigInteger;

var a: bigint = 0b010101010101;
var idx: uint;

idx = a.scan0(2);
writeln(idx);

idx = a.scan1(3);
writeln(idx);
4 changes: 4 additions & 0 deletions test/deprecated/BigInteger/scan01.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
scan01.chpl:7: warning: scan0 is deprecated - please use bigint.findNext0 instead
scan01.chpl:10: warning: scan1 is deprecated - please use bigint.findNext1 instead
3
4
14 changes: 14 additions & 0 deletions test/library/standard/BigInteger/getStr.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use BigInteger;
use IO.FormattedIO;

config const executeLocale = 0;

var a: bigint = 17;

on Locales[min(Locales.domain.high, executeLocale)] {
var s = a:string; // test cast in multilocal and local
writeln(s);
writeln(a); // test writeThis in multilocal and local
writef("%?\n", a); // check formatted strings
writeln("%?".format(a)); // check formatted strings
}
2 changes: 2 additions & 0 deletions test/library/standard/BigInteger/getStr.execopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-sexecuteLocale=0
-sexecuteLocale=1
4 changes: 4 additions & 0 deletions test/library/standard/BigInteger/getStr.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
17
17
17
17
52 changes: 26 additions & 26 deletions test/library/standard/BigInteger/resultAsArgument.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ use BigInteger;
writeln(a);
}
{
write("rootrem ");
write("rootRem ");
var a = new bigint(5);
var b: bigint;
rootrem(a, b, a, 2:uint);
rootRem(a, b, a, 2:uint);
writeln(a, " ", b);
}
{
write("rootrem ");
write("rootRem ");
var a = new bigint(5);
var b: bigint;
rootrem(b, a, a, 2:uint);
rootRem(b, a, a, 2:uint);
writeln(b, " ", a);
}
{
Expand All @@ -90,17 +90,17 @@ use BigInteger;
writeln(a);
}
{
write("sqrtrem ");
write("sqrtRem ");
var a = new bigint(10);
var b: bigint;
sqrtrem(a, b, a);
sqrtRem(a, b, a);
writeln(a, " ", b);
}
{
write("sqrtrem ");
write("sqrtRem ");
var a = new bigint(10);
var b: bigint;
sqrtrem(b, a, a);
sqrtRem(b, a, a);
writeln(b, " ", a);
}
{
Expand Down Expand Up @@ -294,43 +294,43 @@ use BigInteger;
writeln(a);
}
{
write("addmul ");
write("addMul ");
var a = new bigint(5);
var b = new bigint(6);
addmul(a, a, b);
addMul(a, a, b);
writeln(a);
}
{
write("addmul ");
write("addMul ");
var a = new bigint(5);
var b = new bigint(6);
addmul(b, a, b);
addMul(b, a, b);
writeln(b);
}
{
write("addmul ");
write("addMul ");
var a = new bigint(5);
addmul(a, a, 6:uint);
addMul(a, a, 6:uint);
writeln(a);
}
{
write("submul ");
write("subMul ");
var a = new bigint(5);
var b = new bigint(6);
submul(a, a, b);
subMul(a, a, b);
writeln(a);
}
{
write("submul ");
write("subMul ");
var a = new bigint(5);
var b = new bigint(6);
submul(b, a, b);
subMul(b, a, b);
writeln(b);
}
{
write("submul ");
write("subMul ");
var a = new bigint(5);
submul(a, a, 6:uint);
subMul(a, a, 6:uint);
writeln(a);
}
{
Expand Down Expand Up @@ -441,25 +441,25 @@ use BigInteger;
writeln(b);
}
{
write("ior ");
write("or ");
var a = new bigint(5);
var b = new bigint(6);
ior(a, a, b);
or(a, a, b);
writeln(a);
}
{
write("ior ");
write("or ");
var a = new bigint(5);
var b = new bigint(6);
ior(b, a, b);
or(b, a, b);
writeln(b);
}
{
// test the swap behavior where op2 has more limbs than op1
write("ior ");
write("or ");
var a = new bigint(10);
var b = new bigint("1267650600228229401496703205376"); // 2**100
ior(a, a, b);
or(a, a, b);
writeln(a);
}
{
Expand Down
26 changes: 13 additions & 13 deletions test/library/standard/BigInteger/resultAsArgument.good
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ powMod 1
pow 0
pow 16
root 2
rootrem 2 1
rootrem 2 1
rootRem 2 1
rootRem 2 1
sqrt 3
sqrtrem 3 1
sqrtrem 3 1
sqrtRem 3 1
sqrtRem 3 1
nextPrime 17
gcd 4
gcd 4
Expand Down Expand Up @@ -41,12 +41,12 @@ mul 30
mul 30
mul 30
mul 30
addmul 35
addmul 36
addmul 35
submul -25
submul -24
submul -25
addMul 35
addMul 36
addMul 35
subMul -25
subMul -24
subMul -25
mul2Exp 20
neg -5
abs 5
Expand All @@ -63,9 +63,9 @@ mod 1
mod 1
and 4
and 4
ior 7
ior 7
ior 1267650600228229401496703205386
or 7
or 7
or 1267650600228229401496703205386
xor 3
xor 3
com -6
8 changes: 4 additions & 4 deletions test/library/standard/GMP/ldelaney/gmp_Bigint_arithmetic.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ writeln(c);
writeln(a);

// a = a + (b * c)
addmul(a, b, c); // a = 248
addmul(a, b, 10); // a = 268
addMul(a, b, c); // a = 248
addMul(a, b, 10); // a = 268
writeln(a);

// a = a - (b * c)
submul(a, b, c); // a = 668
submul(a, b, 4); // a = 660
subMul(a, b, c); // a = 668
subMul(a, b, 4); // a = 660
writeln(a);

mul2Exp(a, c, 3); // a = -1600
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ if isReal(z) then writeln("real ", z);

a.set(101);

var str = a.get_str();
var str = a:string;

if isString(str) then writeln("string ", str);
Loading