BigNumber

BigNumber

new BigNumber()

Methods

(static) bn_cmp(p, q, base)

比较p,q大小。-1:p<q;0:p=q;1:p>q;

Example
import { bn_cmp } from "ultrain-ts-lib/src/big_number";
Parameters:
Name Type Description
p
q
base

进制,范围2-62

(static) bn_gcd(p, q, base)

求p,q公约数

Example
import { bn_gcd } from "ultrain-ts-lib/src/big_number";
Parameters:
Name Type Description
p
q
base

进制,范围2-62

(static) bn_is_probab_prime(p, reps, base)

判断是否为素数。返回0为合数,1为素数,2可能为素数。p有4^(-reps)概率为合数。

Example
import { bn_is_probab_prime } from "ultrain-ts-lib/src/big_number";
Parameters:
Name Type Description
p
reps

取15至50比较合理,

base

进制,范围2-62

(static) bn_mul(p, q, base)

求p,q乘积

Example
import { bn_mul } from "ultrain-ts-lib/src/big_number";
Parameters:
Name Type Description
p
q
base

进制,范围2-62

(static) bn_pow_mod(m, e, n, base)

求m^e%n

Example
import { bn_pow_mod } from "ultrain-ts-lib/src/big_number";
Parameters:
Name Type Description
m

e

指数

n

除数

base

进制,范围2-62