Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BigDecimal.php

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\Math

Code

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,
    ];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal