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

Breadcrumb

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

function BigInteger::remainder

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

The remainder, when non-zero, has the same sign as the dividend.

Parameters

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

Throws

DivisionByZeroException If the divisor is zero.

File

vendor/brick/math/src/BigInteger.php, line 510

Class

BigInteger
An arbitrary-size integer.

Namespace

Brick\Math

Code

public function remainder(BigNumber|int|float|string $that) : BigInteger {
    $that = BigInteger::of($that);
    if ($that->value === '1') {
        return BigInteger::zero();
    }
    if ($that->value === '0') {
        throw DivisionByZeroException::divisionByZero();
    }
    $remainder = Calculator::get()->divR($this->value, $that->value);
    return new BigInteger($remainder);
}

API Navigation

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