Support for arbitrary precision mathematics in PHP.

Zend_Crypt_Math_BigInteger_Gmp is a wrapper across the PHP BCMath extension.

category Zend
package Zend_Crypt
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

Adds two arbitrary precision numbers

add(resource $left_operand, resource $right_operand) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::add()

Parameters

$left_operand

resource

$right_operand

resource

Returns

string

binaryToInteger()

binaryToInteger(string $operand) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::binaryToInteger()

Parameters

$operand

string

Returns

string

Compare two big integers and returns result as an integer where 0 means both are identical, 1 that left_operand is larger, or -1 that right_operand is larger.

compare(resource $left_operand, resource $right_operand) : integer
inherited_from \Zend_Crypt_Math_BigInteger_Interface::compare()

Parameters

$left_operand

resource

$right_operand

resource

Returns

integer

Divide two big integers and return result or NULL if the denominator is zero.

divide(resource $left_operand, resource $right_operand) : string | null
inherited_from \Zend_Crypt_Math_BigInteger_Interface::divide()

Parameters

$left_operand

resource

$right_operand

resource

Returns

stringnull

hexToDecimal()

hexToDecimal(string $operand) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::hexToDecimal()

Parameters

$operand

string

Returns

string

Initialise a big integer into an extension specific type.

init(string $operand, integer $base = 10) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::init()

Parameters

$operand

string

$base

integer

Returns

string

integerToBinary()

integerToBinary(resource $operand) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::integerToBinary()

Parameters

$operand

resource

GMP number resource

Returns

string

Multiply numbers

multiply(resource $left_operand, resource $right_operand) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::multiply()

Parameters

$left_operand

resource

$right_operand

resource

Returns

string

Raise number into power

pow(resource $left_operand, integer $right_operand) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::pow()

Parameters

$left_operand

resource

$right_operand

integer

Returns

string

Raise number into power with modulo

powmod(resource $left_operand, resource $right_operand, resource $modulus) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::powmod()

Parameters

$left_operand

resource

$right_operand

resource

$modulus

resource

Returns

string

Calculate square root

sqrt($operand) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::sqrt()

Parameters

$operand

Returns

string

Subtract numbers

subtract(resource $left_operand, resource $right_operand) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::subtract()

Parameters

$left_operand

resource

$right_operand

resource

Returns

string