17. Class

17.1. Zend\Math\BigInteger\Adapter\Bcmath

Bcmath extension adapter

17.1.1. Methods

17.1.1.1. __construct

__construct()

Constructor Sets Bcmath scale factor to zero

17.1.1.2. init

init()

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

Parameters:
  • string
  • int|null
Return type:

bool|string

17.1.1.3. add

add()

Add two big integers

Parameters:
  • string
  • string
Return type:

string

17.1.1.4. sub

sub()

Subtract two big integers

Parameters:
  • string
  • string
Return type:

string

17.1.1.5. mul

mul()

Multiply two big integers

Parameters:
  • string
  • string
Return type:

string

17.1.1.6. div

div()

Divide two big integers and return integer part result. Raises exception if the divisor is zero.

Parameters:
  • string
  • string
Return type:

string

Throws :

ExceptionDivisionByZeroException

17.1.1.7. pow

pow()

Raise a big integers to another

Parameters:
  • string
  • string
Return type:

string

17.1.1.8. sqrt

sqrt()

Get the square root of a big integer

Parameters:string
Return type:string

17.1.1.9. abs

abs()

Get absolute value of a big integer

Parameters:string
Return type:string

17.1.1.10. mod

mod()

Get modulus of a big integer

Parameters:
  • string
  • string
Return type:

string

17.1.1.11. powmod

powmod()

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

Parameters:
  • string
  • string
  • string
Return type:

string

17.1.1.12. comp

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.

Parameters:
  • string
  • string
Return type:

int

17.1.1.13. intToBin

intToBin()

Convert big integer into it’s binary number representation

Parameters:
  • string
  • bool – return in two’s complement form
Return type:

string

17.1.1.14. binToInt

binToInt()

Convert big integer into it’s binary number representation

Parameters:
  • string
  • bool – whether binary number is in twos’ complement form
Return type:

string

17.1.1.15. baseConvert

baseConvert()

Base conversion. Bases 2..62 are supported

Parameters:
  • string
  • int
  • int
Return type:

string

Throws :

ExceptionInvalidArgumentException