GMP extension adapter

 Methods

Get absolute value of a big integer

abs(string $operand) : string

Parameters

$operand

string

Returns

string

Add two big integers

add(string $leftOperand, string $rightOperand) : string

Parameters

$leftOperand

string

$rightOperand

string

Returns

string

Base conversion.

baseConvert(string $operand, int $fromBase, int $toBase) : string

Bases 2..62 are supported

Parameters

$operand

string

$fromBase

int

$toBase

int

Exceptions

\Zend\Math\BigInteger\Exception\InvalidArgumentException

Returns

string

Convert binary number into big integer

binToInt(string $bytes, bool $twoc) : string

Parameters

$bytes

string

$twoc

bool

whether binary number is in twos' complement form

Returns

string

Compare two big integers and returns result as an integer where Returns < 0 if leftOperand is less than rightOperand; > 0 if leftOperand is greater than rightOperand, and 0 if they are equal.

comp(string $leftOperand, string $rightOperand) : int

Parameters

$leftOperand

string

$rightOperand

string

Returns

int

Divide two big integers and return integer part result.

div(string $leftOperand, string $rightOperand) : string | null

Raises exception if the divisor is zero.

Parameters

$leftOperand

string

$rightOperand

string

Exceptions

\Zend\Math\BigInteger\Exception\DivisionByZeroException

Returns

stringnull

Create string representing big integer in decimal form from arbitrary integer format

init(string $operand, integer | null $base) : bool | string

Parameters

$operand

string

$base

integernull

Returns

boolstring

Convert big integer into it's binary number representation

intToBin(string $int, bool $twoc) : string

Parameters

$int

string

$twoc

bool

return in twos' complement form

Returns

string

Get modulus of a big integer

mod(string $leftOperand, string $modulus) : string

Parameters

$leftOperand

string

$modulus

string

Returns

string

Multiply two big integers

mul(string $leftOperand, string $rightOperand) : string

Parameters

$leftOperand

string

$rightOperand

string

Returns

string

Raise a big integers to another

pow(string $operand, string $exp) : string

Parameters

$operand

string

$exp

string

Returns

string

Raise a big integer to another, reduced by a specified modulus

powmod(string $leftOperand, string $rightOperand, string $modulus) : string

Parameters

$leftOperand

string

$rightOperand

string

$modulus

string

Returns

string

Get the square root of a big integer

sqrt(string $operand) : string

Parameters

$operand

string

Returns

string

Subtract two big integers

sub(string $leftOperand, string $rightOperand) : string

Parameters

$leftOperand

string

$rightOperand

string

Returns

string

 Constants

 

Base62 alphabet for arbitrary base conversion

BASE62_ALPHABET 
Inherited

inherited_from \Zend\Math\BigInteger\Adapter\AdapterInterface::BASE62_ALPHABET