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

Breadcrumb

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

function BigDecimal::quotient

Returns the quotient of the division of this number by the given one.

The quotient has a scale of `0`.

Parameters

BigNumber|int|float|string $that The divisor. Must be convertible to a BigDecimal.:

Throws

MathException If the divisor is not a valid decimal number, or is zero.

File

vendor/brick/math/src/BigDecimal.php, line 331

Class

BigDecimal
Immutable, arbitrary-precision signed decimal numbers.

Namespace

Brick\Math

Code

public function quotient(BigNumber|int|float|string $that) : BigDecimal {
    $that = BigDecimal::of($that);
    if ($that->isZero()) {
        throw DivisionByZeroException::divisionByZero();
    }
    $p = $this->valueWithMinScale($that->scale);
    $q = $that->valueWithMinScale($this->scale);
    $quotient = Calculator::get()->divQ($p, $q);
    return new BigDecimal($quotient, 0);
}

API Navigation

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