| Methods |
public
static
|
loaded(): bool
Returns whether either the GMP or the BCMath library is installed. If neither
of these libraries are installed, the functions in this file will not work.
Returns whether either the GMP or the BCMath library is installed. If neither
of these libraries are installed, the functions in this file will not work.
Returns
true if either GMP or BCMath is installed.
|
#
|
public
|
__construct(mixed $str, int $base = 10)
Parameters
| $str |
An integer, a string in base 2 to 36, or a byte stream in base 256
|
| $base |
an integer between 2 and 36, or 256
|
|
#
|
public
|
val(int $base = 10): string|false
Converts a bignum into a string representation (base 2 to 36) or a byte stream
(base 256)
Converts a bignum into a string representation (base 2 to 36) or a byte stream
(base 256)
Parameters
| $base |
an integer between 2 and 36, or 256
|
Returns
|
#
|
public
|
add(BigNum $b): BigNum
Returns
a bignum representing this + b
|
#
|
public
|
mul(BigNum $b): BigNum
Returns
a bignum representing this * b
|
#
|
public
|
pow(int $exp): BigNum
Parameters
Returns
a bignum representing this ^ exp
|
#
|
public
|
div(BigNum $b): BigNum
Returns
a bignum representing this / b
|
#
|
public
|
mod(BigNum $d): BigNum
Returns
a bignum representing this mod d
|
#
|
public
|
powmod(BigNum $exp, BigNum $mod): BigNum
Raise a number into power with modulo
Raise a number into power with modulo
Parameters
| $exp |
the exponent
|
| $mod |
the modulo
|
Returns
a bignum representing this ^ exp mod mod
|
#
|
public
|
cmp(BigNum $b): int
Returns
positive value if this > b, zero if this = b and a negative value if this < b
|
#
|
public
|
__toString(): string
Returns a string representation.
Returns a string representation.
|
#
|
protected
|
_add(GMP|string $a, GMP|string $b): GMP|string
Returns
a bignum representing a + b
|
#
|
protected
|
_mul(GMP|int|string $a, GMP|int|string $b): GMP|string
Returns
a bignum representing a * b
|
#
|
protected
|
_div(GMP|int|string $a, GMP|int|string $b): GMP|string
Returns
a bignum representing a / b
|
#
|
public
|
_pow(GMP|string $base, int|string $exp): GMP|string
Parameters
| $base |
the base
|
| $exp |
the exponent, as an integer or a bignum
|
Returns
a bignum representing base ^ exp
|
#
|
protected
|
_mod(GMP|int|string $n, GMP|int|string $d): GMP|string
Returns
a bignum representing n mod d
|
#
|
protected
|
_powmod(GMP|string $base, GMP|string $exp, GMP|string $mod): GMP|string|null
Raise a number into power with modulo
Raise a number into power with modulo
Parameters
| $base |
the base
|
| $exp |
the exponent
|
| $mod |
the modulo
|
Returns
a bignum representing base ^ exp mod mod
|
#
|
protected
|
_cmp(GMP|int|string $a, GMP|int|string $b): int
Returns
positive value if a > b, zero if a = b and a negative value if a < b
|
#
|