Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe BigNumber
+ Graphe d'héritage de BigNumber:

Fonctions membres publiques

 isEqualTo ($that)
 
 isLessThan ($that)
 
 isLessThanOrEqualTo ($that)
 
 isGreaterThan ($that)
 
 isGreaterThanOrEqualTo ($that)
 
 isZero ()
 
 isNegative ()
 
 isNegativeOrZero ()
 
 isPositive ()
 
 isPositiveOrZero ()
 
 getSign ()
 
 compareTo ($that)
 
 toBigInteger ()
 
 toBigDecimal ()
 
 toBigRational ()
 
 toScale (int $scale, int $roundingMode=RoundingMode::UNNECESSARY)
 
 toInt ()
 
 toFloat ()
 
 __toString ()
 
 jsonSerialize ()
 

Fonctions membres publiques statiques

static of ($value)
 
static min (... $values)
 
static max (... $values)
 

Fonctions membres protégées statiques

static create (... $args)
 

Fonctions membres privées statiques

static floatToString (float $float)
 
static cleanUp (string $number)
 

Attributs privés

const PARSE_REGEXP
 

Description détaillée

Common interface for arbitrary-precision rational numbers.

-immutable

Documentation des fonctions membres

◆ __toString()

__toString ( )
abstract

Returns a string representation of this number.

The output of this method can be parsed by the of() factory method; this will yield an object equal to this one, without any information loss.

Renvoie
string

Référencé par BigNumber\jsonSerialize().

◆ cleanUp()

static cleanUp ( string  $number)
staticprivate

Removes optional leading zeros and + sign from the given number.

Paramètres
string$numberThe number, validated as a non-empty string of digits with optional sign.
Renvoie
string

-pure

◆ compareTo()

compareTo (   $that)
abstract

Compares this number to the given one.

Paramètres
BigNumber | int | float | string$that
Renvoie
int [-1,0,1] If $this is lower than, equal to, or greater than $that.
Exceptions
MathExceptionIf the number is not valid.

Référencé par BigNumber\isEqualTo(), BigNumber\isGreaterThan(), BigNumber\isGreaterThanOrEqualTo(), BigNumber\isLessThan(), et BigNumber\isLessThanOrEqualTo().

◆ create()

static create (   $args)
staticprotected

Proxy method to access protected constructors from sibling classes.

-suppress TooManyArguments

Référencé par BigDecimal\getUnscaledValue(), BigInteger\toBigDecimal(), BigDecimal\toBigInteger(), BigDecimal\toBigRational(), et BigInteger\toBigRational().

◆ floatToString()

static floatToString ( float  $float)
staticprivate

Safely converts float to string, avoiding locale-dependent issues.

Voir également
https://github.com/brick/math/pull/20
Paramètres
float$float
Renvoie
string

-pure -suppress ImpureFunctionCall

Références $result.

◆ getSign()

getSign ( )
abstract

Returns the sign of this number.

Renvoie
int -1 if the number is negative, 0 if zero, 1 if positive.

Référencé par BigNumber\isNegative(), BigNumber\isNegativeOrZero(), BigNumber\isPositive(), BigNumber\isPositiveOrZero(), et BigNumber\isZero().

◆ isEqualTo()

isEqualTo (   $that)

Checks if this number is equal to the given one.

Paramètres
BigNumber | int | float | string$that
Renvoie
bool

Références BigNumber\compareTo().

◆ isGreaterThan()

isGreaterThan (   $that)

Checks if this number is strictly greater than the given one.

Paramètres
BigNumber | int | float | string$that
Renvoie
bool

Références BigNumber\compareTo().

◆ isGreaterThanOrEqualTo()

isGreaterThanOrEqualTo (   $that)

Checks if this number is greater than or equal to the given one.

Paramètres
BigNumber | int | float | string$that
Renvoie
bool

Références BigNumber\compareTo().

Référencé par SignedIntegerObject\createBigInteger().

◆ isLessThan()

isLessThan (   $that)

Checks if this number is strictly lower than the given one.

Paramètres
BigNumber | int | float | string$that
Renvoie
bool

Références BigNumber\compareTo().

Référencé par UnsignedIntegerObject\createBigInteger().

◆ isLessThanOrEqualTo()

isLessThanOrEqualTo (   $that)

Checks if this number is lower than or equal to the given one.

Paramètres
BigNumber | int | float | string$that
Renvoie
bool

Références BigNumber\compareTo().

◆ isNegative()

isNegative ( )

Checks if this number is strictly negative.

Renvoie
bool

Références BigNumber\getSign().

Référencé par BigDecimal\abs(), BigInteger\abs(), BigInteger\getBitLength(), BigInteger\modInverse(), BigInteger\modPow(), et BigInteger\toBytes().

◆ isNegativeOrZero()

isNegativeOrZero ( )

Checks if this number is negative or zero.

Renvoie
bool

Références BigNumber\getSign().

◆ isPositive()

isPositive ( )

Checks if this number is strictly positive.

Renvoie
bool

Références BigNumber\getSign().

◆ isPositiveOrZero()

isPositiveOrZero ( )

Checks if this number is positive or zero.

Renvoie
bool

Références BigNumber\getSign().

Référencé par BigInteger\shiftedRight().

◆ isZero()

isZero ( )

Checks if this number equals zero.

Renvoie
bool

Références BigNumber\getSign().

◆ jsonSerialize()

jsonSerialize ( )

{}

Références BigNumber\__toString().

◆ max()

static max (   $values)
static

Returns the maximum of the given values.

Paramètres
BigNumber|int|float|string...$values The numbers to compare. All the numbers need to be convertible to an instance of the class this method is called on.
Renvoie
static The maximum value.
Exceptions

Références $value, et null.

◆ min()

static min (   $values)
static

Returns the minimum of the given values.

Paramètres
BigNumber|int|float|string...$values The numbers to compare. All the numbers need to be convertible to an instance of the class this method is called on.
Renvoie
static The minimum value.
Exceptions

Références $value, et null.

◆ of()

static of (   $value)
static

Creates a BigNumber of the given value.

The concrete return type is dependent on the given value, with the following rules:

  • BigNumber instances are returned as is
  • integer numbers are returned as BigInteger
  • floating point numbers are converted to a string then parsed as such
  • strings containing a / character are returned as BigRational
  • strings containing a . character or using an exponential notation are returned as BigDecimal
  • strings containing only digits with an optional leading + or - sign are returned as BigInteger
Paramètres
BigNumber | int | float | string$value
Renvoie
BigNumber
Exceptions
NumberFormatExceptionIf the format of the number is not valid.
DivisionByZeroExceptionIf the value represents a rational number with a denominator of zero.

-pure

Références $value, et DivisionByZeroException\denominatorMustNotBeZero().

Référencé par BigDecimal\compareTo(), et BigInteger\compareTo().

◆ toBigDecimal()

toBigDecimal ( )
abstract

Converts this number to a BigDecimal.

Renvoie
BigDecimal The converted number.
Exceptions
RoundingNecessaryExceptionIf this number cannot be converted to a BigDecimal without rounding.

Référencé par BigDecimal\of().

◆ toBigInteger()

toBigInteger ( )
abstract

Converts this number to a BigInteger.

Renvoie
BigInteger The converted number.
Exceptions
RoundingNecessaryExceptionIf this number cannot be converted to a BigInteger without rounding.

Référencé par BigInteger\of().

◆ toBigRational()

toBigRational ( )
abstract

Converts this number to a BigRational.

Renvoie
BigRational The converted number.

Référencé par BigRational\of().

◆ toFloat()

toFloat ( )
abstract

Returns an approximation of this number as a floating-point value.

Note that this method can discard information as the precision of a floating-point value is inherently limited.

If the number is greater than the largest representable floating point number, positive infinity is returned. If the number is less than the smallest representable floating point number, negative infinity is returned.

Renvoie
float The converted value.

◆ toInt()

toInt ( )
abstract

Returns the exact value of this number as a native integer.

If this number cannot be converted to a native integer without losing precision, an exception is thrown. Note that the acceptable range for an integer depends on the platform and differs for 32-bit and 64-bit.

Renvoie
int The converted value.
Exceptions
MathExceptionIf this number cannot be exactly converted to a native integer.

◆ toScale()

toScale ( int  $scale,
int  $roundingMode = RoundingMode::UNNECESSARY 
)
abstract

Converts this number to a BigDecimal with the given scale, using rounding if necessary.

Paramètres
int$scaleThe scale of the resulting BigDecimal.
int$roundingModeA RoundingMode constant.
Renvoie
BigDecimal
Exceptions
RoundingNecessaryExceptionIf this number cannot be converted to the given scale without rounding. This only applies when RoundingMode::UNNECESSARY is used.

Documentation des champs

◆ PARSE_REGEXP

const PARSE_REGEXP
private
Valeur initiale :
=
'/^' .
'(?<integral>[\-\+]?[0-9]+)' .
'(?:' .
'(?:' .
'(?:\.(?<fractional>[0-9]+))?' .
'(?:[eE](?<exponent>[\-\+]?[0-9]+))?' .
')' . '|' . '(?:' .
'(?:\/(?<denominator>[0-9]+))?' .
')' .
')?' .
'$/'

La documentation de cette classe a été générée à partir du fichier suivant :