Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques statiques | |
static | of ($value) |
static | ofUnscaledValue ($value, int $scale=0) |
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, int $scale=0) | |
Fonctions membres privées | |
scaleValues (BigDecimal $x, BigDecimal $y) | |
valueWithMinScale (int $scale) | |
getUnscaledValueWithLeadingZeros () | |
Attributs privés | |
$value | |
$scale | |
Membres hérités additionnels | |
Fonctions membres protégées statiques hérités de BigNumber | |
static | create (... $args) |
Immutable, arbitrary-precision signed decimal numbers.
-immutable
|
protected |
Protected constructor. Use a factory method to obtain an instance.
string | $value | The unscaled value, validated. |
int | $scale | The scale, validated. |
Références BigDecimal\$scale, BigDecimal\$value, et value.
__toString | ( | ) |
{}
Références BigDecimal\$value, et BigDecimal\getUnscaledValueWithLeadingZeros().
abs | ( | ) |
Returns the absolute value of this number.
Références $this, BigNumber\isNegative(), et BigDecimal\negated().
compareTo | ( | $that | ) |
{}
Références $b, $this, Calculator\get(), BigNumber\of(), et BigDecimal\scaleValues().
dividedBy | ( | $that, | |
?int | $scale = null , |
||
int | $roundingMode = RoundingMode::UNNECESSARY |
||
) |
Returns the result of the division of this number by the given one, at the given scale.
BigNumber | int | float | string | $that | The divisor. |
int | null | $scale | The desired scale, or null to use the scale of this number. |
int | $roundingMode | An optional rounding mode. |
Références $result, BigDecimal\$scale, $this, DivisionByZeroException\divisionByZero(), elseif, Calculator\get(), null, BigDecimal\of(), et BigDecimal\valueWithMinScale().
Référencé par BigDecimal\exactlyDividedBy(), BigDecimal\toBigInteger(), et BigDecimal\toScale().
exactlyDividedBy | ( | $that | ) |
Returns the exact result of the division of this number by the given one.
The scale of the result is automatically calculated to fit all the fraction digits.
BigNumber | int | float | string | $that | The divisor. Must be convertible to a BigDecimal. |
MathException | If the divisor is not a valid number, is not convertible to a BigDecimal, is zero, or the result yields an infinite number of digits. |
Références $b, BigDecimal\$scale, $this, BigDecimal\dividedBy(), DivisionByZeroException\divisionByZero(), Calculator\get(), BigDecimal\of(), et BigDecimal\scaleValues().
getFractionalPart | ( | ) |
Returns a string representing the fractional part of this decimal number.
If the scale is zero, an empty string is returned.
Examples: -123.456
=> '456', 123
=> ''.
Références BigDecimal\$value, et BigDecimal\getUnscaledValueWithLeadingZeros().
Référencé par BigDecimal\hasNonZeroFractionalPart().
getIntegralPart | ( | ) |
Returns a string representing the integral part of this decimal number.
Example: -123.456
=> -123
.
Références BigDecimal\$value, et BigDecimal\getUnscaledValueWithLeadingZeros().
getScale | ( | ) |
Références BigDecimal\$scale.
getSign | ( | ) |
{}
Références value.
getUnscaledValue | ( | ) |
Références BigNumber\create(), et value.
|
private |
Adds leading zeros if necessary to the unscaled value to represent the full decimal number.
Références BigDecimal\$value.
Référencé par BigDecimal\__toString(), BigDecimal\getFractionalPart(), et BigDecimal\getIntegralPart().
hasNonZeroFractionalPart | ( | ) |
Returns whether this decimal number has a non-zero fractional part.
Références BigDecimal\getFractionalPart().
minus | ( | $that | ) |
Returns the difference of this number and the given one.
The result has a scale of max($this->scale, $that->scale)
.
BigNumber | int | float | string | $that | The number to subtract. Must be convertible to a BigDecimal. |
MathException | If the number is not valid, or is not convertible to a BigDecimal. |
Références $b, BigDecimal\$scale, $this, BigDecimal\$value, Calculator\get(), BigDecimal\of(), et BigDecimal\scaleValues().
multipliedBy | ( | $that | ) |
Returns the product of this number and the given one.
The result has a scale of $this->scale + $that->scale
.
BigNumber | int | float | string | $that | The multiplier. Must be convertible to a BigDecimal. |
MathException | If the multiplier is not a valid number, or is not convertible to a BigDecimal. |
Références BigDecimal\$scale, $this, BigDecimal\$value, Calculator\get(), BigDecimal\of(), et value.
negated | ( | ) |
Returns the negated value of this number.
Références Calculator\get(), et value.
Référencé par BigDecimal\abs().
|
static |
Creates a BigDecimal of the given value.
BigNumber | int | float | string | $value |
MathException | If the value cannot be converted to a BigDecimal. |
-pure
Références BigDecimal\$value, et BigNumber\toBigDecimal().
Référencé par BigDecimal\dividedBy(), BigDecimal\exactlyDividedBy(), BigDecimal\minus(), BigDecimal\multipliedBy(), BigDecimal\plus(), BigDecimal\quotient(), BigDecimal\quotientAndRemainder(), et BigDecimal\remainder().
|
static |
Creates a BigDecimal from an unscaled value and a scale.
Example: (12345, 3)
will result in the BigDecimal 12.345
.
BigNumber | int | float | string | $value | The unscaled value. Must be convertible to a BigInteger. |
int | $scale | The scale of the number, positive or zero. |
Références BigDecimal\$scale, BigDecimal\$value, et BigInteger\of().
|
static |
Returns a BigDecimal representing one, with a scale of zero.
-pure
-suppress ImpureStaticVariable
Références null.
Référencé par BigDecimal\power(), et BigDecimal\toScale().
plus | ( | $that | ) |
Returns the sum of this number and the given one.
The result has a scale of max($this->scale, $that->scale)
.
BigNumber | int | float | string | $that | The number to add. Must be convertible to a BigDecimal. |
MathException | If the number is not valid, or is not convertible to a BigDecimal. |
Références $b, BigDecimal\$scale, $this, BigDecimal\$value, Calculator\get(), BigDecimal\of(), BigDecimal\scaleValues(), et value.
power | ( | int | $exponent | ) |
Returns this number exponentiated to the given value.
The result has a scale of $this->scale * $exponent
.
int | $exponent | The exponent. |
Références $this, Calculator\get(), Calculator\MAX_POWER, BigDecimal\one(), et value.
quotient | ( | $that | ) |
Returns the quotient of the division of this number by this given one.
The quotient has a scale of 0
.
BigNumber | int | float | string | $that | The divisor. Must be convertible to a BigDecimal. |
MathException | If the divisor is not a valid decimal number, or is zero. |
Références DivisionByZeroException\divisionByZero(), Calculator\get(), BigDecimal\of(), et BigDecimal\valueWithMinScale().
quotientAndRemainder | ( | $that | ) |
Returns the quotient and remainder of the division of this number by the given one.
The quotient has a scale of 0
, and the remainder has a scale of max($this->scale, $that->scale)
.
BigNumber | int | float | string | $that | The divisor. Must be convertible to a BigDecimal. |
MathException | If the divisor is not a valid decimal number, or is zero. |
Références BigDecimal\$scale, DivisionByZeroException\divisionByZero(), Calculator\get(), BigDecimal\of(), et BigDecimal\valueWithMinScale().
remainder | ( | $that | ) |
Returns the remainder of the division of this number by this given one.
The remainder has a scale of max($this->scale, $that->scale)
.
BigNumber | int | float | string | $that | The divisor. Must be convertible to a BigDecimal. |
MathException | If the divisor is not a valid decimal number, or is zero. |
Références BigDecimal\$scale, DivisionByZeroException\divisionByZero(), Calculator\get(), BigDecimal\of(), et BigDecimal\valueWithMinScale().
|
private |
Puts the internal values of the given decimal numbers on the same scale.
BigDecimal | $x | The first decimal number. |
BigDecimal | $y | The second decimal number. |
Référencé par BigDecimal\compareTo(), BigDecimal\exactlyDividedBy(), BigDecimal\minus(), et BigDecimal\plus().
serialize | ( | ) |
This method is required by interface Serializable and SHOULD NOT be accessed directly.
Références BigDecimal\$scale, et value.
sqrt | ( | int | $scale | ) |
Returns the square root of this number, rounded down to the given number of decimals.
int | $scale |
Références BigDecimal\$scale, BigDecimal\$value, elseif, Calculator\get(), et value.
stripTrailingZeros | ( | ) |
Returns a copy of this BigDecimal with any trailing zeros removed from the fractional part.
Références BigDecimal\$scale, $this, BigDecimal\$value, value, et BigDecimal\zero().
|
static |
Returns a BigDecimal representing ten, with a scale of zero.
-pure
-suppress ImpureStaticVariable
Références null.
toBigDecimal | ( | ) |
toBigInteger | ( | ) |
{}
Références $this, BigNumber\create(), et BigDecimal\dividedBy().
Référencé par BigDecimal\toInt().
toBigRational | ( | ) |
{}
Références BigNumber\create(), et value.
toFloat | ( | ) |
{}
Références $this.
toInt | ( | ) |
{}
Références BigDecimal\toBigInteger().
toScale | ( | int | $scale, |
int | $roundingMode = RoundingMode::UNNECESSARY |
||
) |
{}
Références BigDecimal\$scale, $this, BigDecimal\dividedBy(), et BigDecimal\one().
unserialize | ( | $value | ) |
This method is only here to implement interface Serializable and cannot be accessed directly.
Références BigDecimal\$scale, BigDecimal\$value, et value.
|
private |
int | $scale |
Références BigDecimal\$scale, BigDecimal\$value, et value.
Référencé par BigDecimal\dividedBy(), BigDecimal\quotient(), BigDecimal\quotientAndRemainder(), et BigDecimal\remainder().
withPointMovedLeft | ( | int | $n | ) |
Returns a copy of this BigDecimal with the decimal point moved $n places to the left.
int | $n |
Références $n, $this, value, et BigDecimal\withPointMovedRight().
Référencé par BigDecimal\withPointMovedRight().
withPointMovedRight | ( | int | $n | ) |
Returns a copy of this BigDecimal with the decimal point moved $n places to the right.
int | $n |
Références $n, BigDecimal\$scale, $this, BigDecimal\$value, et BigDecimal\withPointMovedLeft().
Référencé par BigDecimal\withPointMovedLeft().
|
static |
Returns a BigDecimal representing zero, with a scale of zero.
-pure
-suppress ImpureStaticVariable
Références null.
Référencé par BigDecimal\stripTrailingZeros().
|
private |
Référencé par BigDecimal\__construct(), BigDecimal\dividedBy(), BigDecimal\exactlyDividedBy(), BigDecimal\getScale(), BigDecimal\minus(), BigDecimal\multipliedBy(), BigDecimal\ofUnscaledValue(), BigDecimal\plus(), BigDecimal\quotientAndRemainder(), BigDecimal\remainder(), BigDecimal\serialize(), BigDecimal\sqrt(), BigDecimal\stripTrailingZeros(), BigDecimal\toScale(), BigDecimal\unserialize(), BigDecimal\valueWithMinScale(), et BigDecimal\withPointMovedRight().
|
private |
Référencé par BigDecimal\__construct(), BigDecimal\__toString(), BigDecimal\getFractionalPart(), BigDecimal\getIntegralPart(), BigDecimal\getUnscaledValueWithLeadingZeros(), BigDecimal\minus(), BigDecimal\multipliedBy(), BigDecimal\of(), BigDecimal\ofUnscaledValue(), BigDecimal\plus(), BigDecimal\sqrt(), BigDecimal\stripTrailingZeros(), BigDecimal\unserialize(), BigDecimal\valueWithMinScale(), et BigDecimal\withPointMovedRight().