function BigDecimal::scaleValues
Puts the internal values of the given decimal numbers on the same scale.
Return value
array{string, string} The scaled integer values of $x and $y.
4 calls to BigDecimal::scaleValues()
- BigDecimal::compareTo in vendor/
brick/ math/ src/ BigDecimal.php - Compares this number to the given one.
- BigDecimal::exactlyDividedBy in vendor/
brick/ math/ src/ BigDecimal.php - Returns the exact result of the division of this number by the given one.
- BigDecimal::minus in vendor/
brick/ math/ src/ BigDecimal.php - Returns the difference of this number and the given one.
- BigDecimal::plus in vendor/
brick/ math/ src/ BigDecimal.php - Returns the sum of this number and the given one.
File
-
vendor/
brick/ math/ src/ BigDecimal.php, line 699
Class
- BigDecimal
- Immutable, arbitrary-precision signed decimal numbers.
Namespace
Brick\MathCode
private function scaleValues(BigDecimal $x, BigDecimal $y) : array {
$a = $x->value;
$b = $y->value;
if ($b !== '0' && $x->scale > $y->scale) {
$b .= \str_repeat('0', $x->scale - $y->scale);
}
elseif ($a !== '0' && $x->scale < $y->scale) {
$a .= \str_repeat('0', $y->scale - $x->scale);
}
return [
$a,
$b,
];
}