mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-30 15:04:24 +03:00
removed bignum support and qjscalc - added optimized BigInt implementation
This commit is contained in:
@@ -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;) {
|
||||
|
Reference in New Issue
Block a user