Class Bcmath

Summary

Fully Qualified Name: Zend\Math\BigInteger\Adapter\Bcmath
Implements: AdapterInterface

Description

Bcmath extension adapter

Methods

Name Description Defined By
abs() Get absolute value of a big integer Bcmath
add() Add two big integers Bcmath
baseConvert() Base conversion. Bases 2. Bcmath
binToInt() Convert big integer into it's binary number representation Bcmath
comp() 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. Bcmath
div() Divide two big integers and return integer part result. Bcmath
init() Create string representing big integer in decimal form from arbitrary integer format Bcmath
intToBin() Convert big integer into it's binary number representation Bcmath
mod() Get modulus of a big integer Bcmath
mul() Multiply two big integers Bcmath
pow() Raise a big integers to another Bcmath
powmod() Raise a big integer to another, reduced by a specified modulus Bcmath
sqrt() Get the square root of a big integer Bcmath
sub() Subtract two big integers Bcmath

Method Details

abs()

Get absolute value of a big integer

Parameter Name Type Description
$operand string

Returns: string

add()

Add two big integers

Parameter Name Type Description
$leftOperand string
$rightOperand string

Returns: string

baseConvert()

Base conversion. Bases 2.

.62 are supported

Parameter Name Type Description
$operand string
$fromBase int
$toBase int

Returns: string

binToInt()

Convert big integer into it's binary number representation

Parameter Name Type Description
$bytes string
$twoc bool whether

Returns: string

comp()

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.

Parameter Name Type Description
$leftOperand string
$rightOperand string

Returns: int

div()

Divide two big integers and return integer part result.

Raises exception if the divisor is zero.

Parameter Name Type Description
$leftOperand string
$rightOperand string

Returns: string

init()

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

Parameter Name Type Description
$operand string
$base int|null

Returns: bool|string

intToBin()

Convert big integer into it's binary number representation

Parameter Name Type Description
$operand string
$twoc bool return

Returns: string

mod()

Get modulus of a big integer

Parameter Name Type Description
$leftOperand string
$rightOperand string

Returns: string

mul()

Multiply two big integers

Parameter Name Type Description
$leftOperand string
$rightOperand string

Returns: string

pow()

Raise a big integers to another

Parameter Name Type Description
$operand string
$exp string

Returns: string

powmod()

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

Parameter Name Type Description
$leftOperand string
$rightOperand string
$modulus string

Returns: string

sqrt()

Get the square root of a big integer

Parameter Name Type Description
$operand string

Returns: string

sub()

Subtract two big integers

Parameter Name Type Description
$leftOperand string
$rightOperand string

Returns: string

Top