Support for arbitrary precision mathematics in PHP.

Zend_Crypt_Math_BigInteger_Bcmath 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(string $left_operand, string $right_operand) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::add()

Parameters

$left_operand

string

$right_operand

string

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(string $left_operand, string $right_operand) : integer
inherited_from \Zend_Crypt_Math_BigInteger_Interface::compare()

Parameters

$left_operand

string

$right_operand

string

Returns

integer

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

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

Parameters

$left_operand

string

$right_operand

string

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. This is not applicable to BCMath.

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

Parameters

$operand

string

$base

integer

Returns

string

integerToBinary()

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

Parameters

$operand

string

Returns

string

Get modulus of an arbitrary precision number

modulus(string $left_operand, string $modulus) : string
inherited_from \Zend_Crypt_Math_BigInteger_Interface::modulus()

Parameters

$left_operand

string

$modulus

string

Returns

string

Multiply two arbitrary precision numbers

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

Parameters

$left_operand

string

$right_operand

string

Returns

string

Raise an arbitrary precision number to another

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

Parameters

$left_operand

string

$right_operand

string

Returns

string

Raise an arbitrary precision number to another, reduced by a specified modulus

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

Parameters

$left_operand

string

$right_operand

string

$modulus

string

Returns

string

Get the square root of an arbitrary precision number

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

Parameters

$operand

string

Returns

string

Subtract one arbitrary precision number from another

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

Parameters

$left_operand

string

$right_operand

string

Returns

string