Methods Summary | ||
---|---|---|
protected
|
#
__construct( string $value , int $scale = 0 )
Protected constructor. Use a factory method to obtain an instance.
|
|
public static
|
||
public static
|
#
ofUnscaledValue( \BigNumber|\number|string $value , int $scale = 0 )
Creates a BigDecimal from an unscaled value and a scale.
Example: `(12345, 3)` will result in the BigDecimal `12.345`.
|
|
public static
|
||
public static
|
||
public static
|
||
public
|
||
public
|
||
public
|
#
multipliedBy( \BigNumber|\number|string $that )
Returns the product of this number and the given one.
The result has a scale of `$this->scale + $that->scale`.
|
|
public
|
||
public
|
#
exactlyDividedBy( \BigNumber|\number|string $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.
|
|
public
|
||
public
|
||
public
|
||
public
|
#
quotientAndRemainder( \BigNumber|\number|string $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)`.
|
|
public
|
#
withPointMovedLeft( int $n )
Returns a copy of this BigDecimal with the decimal point moved $n places to the left.
|
|
public
|
#
withPointMovedRight( int $n )
Returns a copy of this BigDecimal with the decimal point moved $n places to the right.
|
|
public
|
#
stripTrailingZeros( )
Returns a copy of this BigDecimal with any trailing zeros removed from the fractional part.
|
|
public
|
||
public
|
||
public
|
||
public
|
||
public
|
||
public
|
||
public
|
#
getIntegral( )
Returns a string representing the integral part of this decimal number.
Example: `-123.456` => `-123`.
|
|
public
|
#
getFraction( )
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` => ''.
|
|
public
|
||
public
|
||
public
|
||
public
|
||
public
|
||
public
|
||
public
|