Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques statiques | |
static | of ($value) |
static | parse (string $number, int $base=10) |
static | fromBase (string $number, int $base) |
static | fromArbitraryBase (string $number, string $alphabet) |
static | fromBytes (string $value, bool $signed=true) |
static | randomBits (int $numBits, ?callable $randomBytesGenerator=null) |
static | randomRange ($min, $max, ?callable $randomBytesGenerator=null) |
static | zero () |
static | one () |
static | ten () |
Fonctions membres publiques statiques hérités de BigNumber | |
static | of ($value) |
static | min (... $values) |
static | max (... $values) |
Fonctions membres protégées | |
__construct (string $value) | |
Attributs privés | |
$value | |
Membres hérités additionnels | |
Fonctions membres protégées statiques hérités de BigNumber | |
static | create (... $args) |
An arbitrary-size integer.
All methods accepting a number as a parameter accept either a BigInteger instance, an integer, or a string representing an arbitrary size integer.
-immutable
|
protected |
Protected constructor. Use a factory method to obtain an instance.
string | $value | A string of digits, with optional leading minus sign. |
Références BigInteger\$value, et value.
__toString | ( | ) |
{}
Références BigInteger\$value.
abs | ( | ) |
Returns the absolute value of this number.
Références $this, BigNumber\isNegative(), et BigInteger\negated().
Référencé par BigInteger\getBitLength(), et BigInteger\toBytes().
and | ( | $that | ) |
Returns the integer bitwise-and combined with another integer.
This method returns a negative BigInteger if and only if both operands are negative.
BigNumber | int | float | string | $that | The operand. Must be convertible to an integer number. |
Références Calculator\get(), BigInteger\of(), et value.
compareTo | ( | $that | ) |
{}
Références $this, Calculator\get(), BigNumber\of(), et value.
dividedBy | ( | $that, | |
int | $roundingMode = RoundingMode::UNNECESSARY |
||
) |
Returns the result of the division of this number by the given one.
BigNumber | int | float | string | $that | The divisor. Must be convertible to a BigInteger. |
int | $roundingMode | An optional rounding mode. |
MathException | If the divisor is not a valid number, is not convertible to a BigInteger, is zero, or RoundingMode::UNNECESSARY is used and the remainder is not zero. |
Références $result, $this, DivisionByZeroException\divisionByZero(), Calculator\get(), BigInteger\of(), et value.
Référencé par BigInteger\shiftedRight().
|
static |
Parses a string containing an integer in an arbitrary base, using a custom alphabet.
Because this method accepts an alphabet with any character, including dash, it does not handle negative numbers.
string | $number | The number to parse. |
string | $alphabet | The alphabet, for example '01' for base 2, or '01234567' for base 8. |
NumberFormatException | If the given number is empty or contains invalid chars for the given alphabet. |
Références $base, NumberFormatException\charNotInAlphabet(), et Calculator\get().
|
static |
Creates a number from a string in a given base.
The string can optionally be prefixed with the +
or -
sign.
Bases greater than 36 are not supported by this method, as there is no clear consensus on which of the lowercase or uppercase characters should come first. Instead, this method accepts any base up to 36, and does not differentiate lowercase and uppercase characters, which are considered equal.
For bases greater than 36, and/or custom alphabets, use the fromArbitraryBase() method.
string | $number | The number to convert, in the given base. |
int | $base | The base of the number, between 2 and 36. |
NumberFormatException | If the number is empty, or contains invalid chars for the given base. |
Références $base, $result, Calculator\ALPHABET, elseif, Calculator\get(), et BigInteger\zero().
Référencé par NegativeBigIntegerTag\getNormalizedData().
|
static |
Translates a string of bytes containing the binary representation of a BigInteger into a BigInteger.
The input string is assumed to be in big-endian byte-order: the most significant byte is in the zeroth element.
If $signed
is true, the input is assumed to be in two's-complement representation, and the leading bit is interpreted as a sign bit. If $signed
is false, the input is interpreted as an unsigned number, and the resulting BigInteger will always be positive or zero.
This method can be used to retrieve a number exported by toBytes()
, as long as the $signed
flags match.
string | $value | The byte string. |
bool | $signed | Whether to interpret as a signed number in two's-complement representation with a leading sign bit. |
NumberFormatException | If the string is empty. |
Références BigInteger\$value.
gcd | ( | $that | ) |
Returns the greatest common divisor of this number and the given one.
The GCD is always positive, unless both operands are zero, in which case it is zero.
BigNumber | int | float | string | $that | The operand. Must be convertible to an integer number. |
Références $this, BigInteger\$value, Calculator\get(), BigInteger\of(), et value.
getBitLength | ( | ) |
Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit.
For positive BigIntegers, this is equivalent to the number of bits in the ordinary binary representation. Computes (ceil(log2(this < 0 ? -this : this+1))).
Références BigInteger\abs(), BigNumber\isNegative(), BigInteger\toBase(), et value.
Référencé par BigInteger\getLowestSetBit().
getLowestSetBit | ( | ) |
Returns the index of the rightmost (lowest-order) one bit in this BigInteger.
Returns -1 if this BigInteger contains no one bits.
Références $i, $n, $this, et BigInteger\getBitLength().
getSign | ( | ) |
{}
Références value.
isEven | ( | ) |
isOdd | ( | ) |
minus | ( | $that | ) |
Returns the difference of this number and the given one.
BigNumber | int | float | string | $that | The number to subtract. Must be convertible to a BigInteger. |
MathException | If the number is not valid, or is not convertible to a BigInteger. |
Références $this, BigInteger\$value, Calculator\get(), BigInteger\of(), et value.
mod | ( | $that | ) |
Returns the modulo of this number and the given one.
The modulo operation yields the same result as the remainder operation when both operands are of the same sign, and may differ when signs are different.
The result of the modulo operation, when non-zero, has the same sign as the divisor.
BigNumber | int | float | string | $that | The divisor. Must be convertible to a BigInteger. |
DivisionByZeroException | If the divisor is zero. |
Références BigInteger\$value, Calculator\get(), DivisionByZeroException\modulusMustNotBeZero(), BigInteger\of(), et value.
modInverse | ( | BigInteger | $m | ) |
Returns the modular multiplicative inverse of this BigInteger modulo $m.
BigInteger | $m |
DivisionByZeroException | If $m is zero. |
NegativeNumberException | If $m is negative. |
MathException | If this BigInteger has no multiplicative inverse mod m (that is, this BigInteger is not relatively prime to m). |
Références BigInteger\$value, Calculator\get(), BigNumber\isNegative(), DivisionByZeroException\modulusMustNotBeZero(), null, value, et BigInteger\zero().
modPow | ( | $exp, | |
$mod | |||
) |
Returns this number raised into power with modulo.
This operation only works on positive numbers.
BigNumber | int | float | string | $exp | The positive exponent. |
BigNumber | int | float | string | $mod | The modulus. Must not be zero. |
NegativeNumberException | If any of the operands is negative. |
DivisionByZeroException | If the modulus is zero. |
Références $mod, $result, Calculator\get(), BigNumber\isNegative(), DivisionByZeroException\modulusMustNotBeZero(), BigInteger\of(), et value.
Référencé par BigInteger\powerMod().
multipliedBy | ( | $that | ) |
Returns the product of this number and the given one.
BigNumber | int | float | string | $that | The multiplier. Must be convertible to a BigInteger. |
MathException | If the multiplier is not a valid number, or is not convertible to a BigInteger. |
Références $this, BigInteger\$value, Calculator\get(), BigInteger\of(), et value.
Référencé par BigInteger\shiftedLeft().
negated | ( | ) |
Returns the inverse of this number.
Références Calculator\get(), et value.
Référencé par BigInteger\abs().
|
static |
Creates a BigInteger of the given value.
BigNumber | int | float | string | $value |
MathException | If the value cannot be converted to a BigInteger. |
-pure
Références BigInteger\$value, et BigNumber\toBigInteger().
Référencé par BigInteger\and(), BigInteger\dividedBy(), BigInteger\gcd(), NegativeBigIntegerTag\getNormalizedData(), BigInteger\minus(), BigInteger\mod(), BigInteger\modPow(), BigInteger\multipliedBy(), BigRational\nd(), BigDecimal\ofUnscaledValue(), BigInteger\or(), BigInteger\plus(), BigInteger\quotient(), BigInteger\quotientAndRemainder(), BigInteger\randomRange(), BigInteger\remainder(), BigInteger\shiftedLeft(), BigInteger\shiftedRight(), BigRational\unserialize(), et BigInteger\xor().
|
static |
Returns a BigInteger representing one.
-pure
-suppress ImpureStaticVariable
Références null.
Référencé par DoublePrecisionFloatObject\getSign(), HalfPrecisionFloatObject\getSign(), SinglePrecisionFloatObject\getSign(), BigRational\one(), BigRational\power(), BigInteger\power(), BigRational\ten(), BigInteger\toBigRational(), et BigRational\zero().
or | ( | $that | ) |
Returns the integer bitwise-or combined with another integer.
This method returns a negative BigInteger if and only if either of the operands is negative.
BigNumber | int | float | string | $that | The operand. Must be convertible to an integer number. |
Références Calculator\get(), BigInteger\of(), et value.
|
static |
Parses a string containing an integer in an arbitrary base.
The string can optionally be prefixed with the +
or -
sign. For bases greater than 10, both uppercase and lowercase letters are allowed.
string | $number | The number to parse. |
int | $base | The base of the number, between 2 and 36. |
Références $base.
plus | ( | $that | ) |
Returns the sum of this number and the given one.
BigNumber | int | float | string | $that | The number to add. Must be convertible to a BigInteger. |
MathException | If the number is not valid, or is not convertible to a BigInteger. |
Références $this, BigInteger\$value, Calculator\get(), BigInteger\of(), et value.
power | ( | int | $exponent | ) |
Returns this number exponentiated to the given value.
int | $exponent | The exponent. |
Références $this, Calculator\get(), Calculator\MAX_POWER, BigInteger\one(), et value.
Référencé par BigInteger\shiftedLeft().
powerMod | ( | $exp, | |
$mod | |||
) |
Returns this number raised into power with modulo.
BigNumber | int | float | string | $exp | The positive exponent. |
BigNumber | int | float | string | $mod | The modulus. Must not be zero. |
NegativeNumberException | If any of the operands is negative. |
DivisionByZeroException | If the modulus is zero. |
Références $mod, et BigInteger\modPow().
quotient | ( | $that | ) |
Returns the quotient of the division of this number by the given one.
BigNumber | int | float | string | $that | The divisor. Must be convertible to a BigInteger. |
DivisionByZeroException | If the divisor is zero. |
Références $this, DivisionByZeroException\divisionByZero(), Calculator\get(), BigInteger\of(), et value.
Référencé par BigInteger\shiftedRight().
quotientAndRemainder | ( | $that | ) |
Returns the quotient and remainder of the division of this number by the given one.
BigNumber | int | float | string | $that | The divisor. Must be convertible to a BigInteger. |
DivisionByZeroException | If the divisor is zero. |
Références DivisionByZeroException\divisionByZero(), Calculator\get(), BigInteger\of(), et value.
|
static |
Generates a pseudo-random number in the range 0 to 2^numBits - 1.
Using the default random bytes generator, this method is suitable for cryptographic use.
int | $numBits | The number of bits. |
callable | null | $randomBytesGenerator | A function that accepts a number of bytes as an integer, and returns a string of random bytes of the given length. Defaults to the random_bytes() function. |
Références null, et BigInteger\zero().
|
static |
Generates a pseudo-random number between $min
and $max
.
Using the default random bytes generator, this method is suitable for cryptographic use.
BigNumber | int | float | string | $min | The lower bound. Must be convertible to a BigInteger. |
BigNumber | int | float | string | $max | The upper bound. Must be convertible to a BigInteger. |
callable | null | $randomBytesGenerator | A function that accepts a number of bytes as an integer, and returns a string of random bytes of the given length. Defaults to the random_bytes() function. |
MathException | If one of the parameters cannot be converted to a BigInteger, or $min is greater than $max . |
Références BigInteger\of().
remainder | ( | $that | ) |
Returns the remainder of the division of this number by the given one.
The remainder, when non-zero, has the same sign as the dividend.
BigNumber | int | float | string | $that | The divisor. Must be convertible to a BigInteger. |
DivisionByZeroException | If the divisor is zero. |
Références DivisionByZeroException\divisionByZero(), Calculator\get(), BigInteger\of(), value, et BigInteger\zero().
serialize | ( | ) |
This method is required by interface Serializable and SHOULD NOT be accessed directly.
Références BigInteger\$value.
shiftedLeft | ( | int | $distance | ) |
Returns the integer left shifted by a given number of bits.
int | $distance | The distance to shift. |
Références $this, BigInteger\multipliedBy(), BigInteger\of(), BigInteger\power(), et BigInteger\shiftedRight().
Référencé par BigInteger\shiftedRight().
shiftedRight | ( | int | $distance | ) |
Returns the integer right shifted by a given number of bits.
int | $distance | The distance to shift. |
Références $this, BigInteger\dividedBy(), BigNumber\isPositiveOrZero(), BigInteger\of(), BigInteger\quotient(), BigInteger\shiftedLeft(), et RoundingMode\UP.
Référencé par BigInteger\shiftedLeft(), et BigInteger\testBit().
sqrt | ( | ) |
Returns the integer square root number of this number, rounded down.
The result is the largest x such that x² ≤ n.
NegativeNumberException | If this number is negative. |
Références BigInteger\$value, Calculator\get(), et value.
|
static |
Returns a BigInteger representing ten.
-pure
-suppress ImpureStaticVariable
Références null.
Référencé par BigRational\ten().
testBit | ( | int | $n | ) |
Returns true if and only if the designated bit is set.
Computes ((this & (1<<n)) != 0).
int | $n | The bit to test, 0-based. |
Références $n, et BigInteger\shiftedRight().
toArbitraryBase | ( | string | $alphabet | ) |
Returns a string representation of this number in an arbitrary base with a custom alphabet.
Because this method accepts an alphabet with any character, including dash, it does not handle negative numbers; a NegativeNumberException will be thrown when attempting to call this method on a negative number.
string | $alphabet | The alphabet, for example '01' for base 2, or '01234567' for base 8. |
NegativeNumberException | If this number is negative. |
Références $base, Calculator\get(), et value.
toBase | ( | int | $base | ) |
Returns a string representation of this number in the given base.
The output will always be lowercase for bases greater than 10.
int | $base |
Références $base, BigInteger\$value, Calculator\get(), et value.
Référencé par UnsignedIntegerObject\createBigInteger(), et BigInteger\getBitLength().
toBigDecimal | ( | ) |
toBigInteger | ( | ) |
{}
Références $this.
toBigRational | ( | ) |
{}
Références $this, BigNumber\create(), et BigInteger\one().
toBytes | ( | bool | $signed = true | ) |
Returns a string of bytes containing the binary representation of this BigInteger.
The string is in big-endian byte-order: the most significant byte is in the zeroth element.
If $signed
is true, the output will be in two's-complement representation, and a sign bit will be prepended to the output. If $signed
is false, no sign bit will be prepended, and this method will throw an exception if the number is negative.
The string will contain the minimum number of bytes required to represent this BigInteger, including a sign bit if $signed
is true.
This representation is compatible with the fromBytes()
factory method, as long as the $signed
flags match.
bool | $signed | Whether to output a signed number in two's-complement representation with a leading sign bit. |
NegativeNumberException | If $signed is false, and the number is negative. |
Références BigInteger\abs(), et BigNumber\isNegative().
toFloat | ( | ) |
{}
Références BigInteger\$value.
toInt | ( | ) |
{}
Références $this, IntegerOverflowException\toIntOverflow(), et value.
Référencé par UnsignedIntegerObject\createBigInteger().
toScale | ( | int | $scale, |
int | $roundingMode = RoundingMode::UNNECESSARY |
||
) |
{}
Références BigInteger\toBigDecimal().
unserialize | ( | $value | ) |
This method is only here to implement interface Serializable and cannot be accessed directly.
Références BigInteger\$value, et value.
xor | ( | $that | ) |
Returns the integer bitwise-xor combined with another integer.
This method returns a negative BigInteger if and only if exactly one of the operands is negative.
BigNumber | int | float | string | $that | The operand. Must be convertible to an integer number. |
Références Calculator\get(), BigInteger\of(), et value.
|
static |
Returns a BigInteger representing zero.
-pure
-suppress ImpureStaticVariable
Références null.
Référencé par BigInteger\fromBase(), BigInteger\modInverse(), BigInteger\randomBits(), BigInteger\remainder(), et BigRational\zero().
|
private |
Référencé par BigInteger\__construct(), BigInteger\__toString(), BigInteger\fromBytes(), BigInteger\gcd(), BigInteger\minus(), BigInteger\mod(), BigInteger\modInverse(), BigInteger\multipliedBy(), BigInteger\of(), BigInteger\plus(), BigInteger\serialize(), BigInteger\sqrt(), BigInteger\toBase(), BigInteger\toFloat(), et BigInteger\unserialize().