Documentation

DebugDecorator
in package
implements GmpMathInterface

Debug helper class to trace all calls to math functions along with the provided params and result.

Table of Contents

Interfaces

GmpMathInterface

Properties

$adapter  : GmpMathInterface
$writer  : callable

Methods

__construct()  : mixed
add()  : GMP
Adds two numbers
baseConvert()  : string
bitwiseAnd()  : GMP
Performs a logical AND between two values.
bitwiseXor()  : GMP
Performs a logical XOR between two values.
cmp()  : int
Compares two numbers
decHex()  : string
Converts a decimal string to hexadecimal.
digestInteger()  : GMP
div()  : GMP
Divides a number by another.
equals()  : bool
gcd2()  : GMP
getEcMath()  : mixed
{@inheritDoc}
getModularArithmetic()  : ModularArithmetic
getNumberTheory()  : NumberTheory
hexDec()  : int|string
Converts an hexadecimal string to decimal.
intToFixedSizeString()  : string
intToString()  : string
inverseMod()  : GMP
isPrime()  : bool
Checks whether a number is a prime.
jacobi()  : int
leftShift()  : GMP
Shifts bits to the left
mod()  : GMP
Returns the remainder of a division
mul()  : GMP
Multiplies a number by another.
nextPrime()  : GMP
Gets the next known prime that is greater than a given prime.
pow()  : GMP
Raises a number to a power.
powmod()  : GMP
Calculates the modular exponent of a number.
rightShift()  : GMP
Shifts bits to the right
stringToInt()  : GMP
sub()  : GMP
Substract one number from another
toString()  : string
Returns the string representation of a returned value.
call()  : mixed
write()  : mixed

Properties

Methods

cmp()

Compares two numbers

public cmp(GMP $first, GMP $other) : int
Parameters
$first : GMP
$other : GMP
Tags
see
GmpMathInterface::cmp()
Return values
int

less than 0 if first is less than second, 0 if equal, greater than 0 if greater than.

leftShift()

Shifts bits to the left

public leftShift(GMP $number, int $positions) : GMP
Parameters
$number : GMP

Number to shift

$positions : int

Number of positions to shift

Tags
see
GmpMathInterface::leftShift()
Return values
GMP

mod()

Returns the remainder of a division

public mod(GMP $number, GMP $modulus) : GMP
Parameters
$number : GMP
$modulus : GMP
Tags
see
GmpMathInterface::mod()
Return values
GMP

mul()

Multiplies a number by another.

public mul(GMP $multiplier, GMP $multiplicand) : GMP
Parameters
$multiplier : GMP
$multiplicand : GMP
Tags
see
GmpMathInterface::mul()
Return values
GMP

pow()

Raises a number to a power.

public pow(GMP $base, int $exponent) : GMP
Parameters
$base : GMP

The number to raise.

$exponent : int

The power to raise the number to.

Tags
see
GmpMathInterface::pow()
Return values
GMP

powmod()

Calculates the modular exponent of a number.

public powmod(GMP $base, GMP $exponent, GMP $modulus) : GMP
Parameters
$base : GMP
$exponent : GMP
$modulus : GMP
Tags
see
GmpMathInterface::powmod()
Return values
GMP

rightShift()

Shifts bits to the right

public rightShift(GMP $number, int $positions) : GMP
Parameters
$number : GMP

Number to shift

$positions : int

Number of positions to shift

Tags
see
GmpMathInterface::rightShift()
Return values
GMP

sub()

Substract one number from another

public sub(GMP $minuend, GMP $subtrahend) : GMP
Parameters
$minuend : GMP
$subtrahend : GMP
Tags
see
GmpMathInterface::sub()
Return values
GMP

toString()

Returns the string representation of a returned value.

public toString(GMP $value) : string
Parameters
$value : GMP
Tags
see
MathAdapter::toString()
Return values
string

call()

private call(string $func, array<string|int, mixed> $args) : mixed
Parameters
$func : string
$args : array<string|int, mixed>

write()

private write(string $message) : mixed
Parameters
$message : string

        
On this page

Search results