removed bignum support and qjscalc - added optimized BigInt implementation

This commit is contained in:
Fabrice Bellard
2025-03-18 18:29:10 +01:00
parent 837a697588
commit 61e8b94428
20 changed files with 2553 additions and 17596 deletions

View File

@@ -687,29 +687,6 @@ function float_arith(n)
return n * 1000;
}
function bigfloat_arith(n)
{
var i, j, sum, a, incr, a0;
global_res = 0;
a0 = BigFloat("0.1");
incr = BigFloat("1.1");
for(j = 0; j < n; j++) {
sum = 0;
a = a0;
for(i = 0; i < 1000; i++) {
sum += a * a;
a += incr;
}
global_res += sum;
}
return n * 1000;
}
function float256_arith(n)
{
return BigFloatEnv.setPrec(bigfloat_arith.bind(null, n), 237, 19);
}
function bigint_arith(n, bits)
{
var i, j, sum, a, incr, a0, sum0;
@@ -728,6 +705,11 @@ function bigint_arith(n, bits)
return n * 1000;
}
function bigint32_arith(n)
{
return bigint_arith(n, 32);
}
function bigint64_arith(n)
{
return bigint_arith(n, 64);
@@ -1231,13 +1213,10 @@ function main(argc, argv, g)
if (typeof BigInt === "function") {
/* BigInt test */
test_list.push(bigint32_arith);
test_list.push(bigint64_arith);
test_list.push(bigint256_arith);
}
if (typeof BigFloat === "function") {
/* BigFloat test */
test_list.push(float256_arith);
}
test_list.push(sort_bench);
for (i = 1; i < argc;) {