public function remainder($that) : BigDecimal
    {
        $that = BigDecimal::of($that);

        if ($that->isZero()) {
            throw DivisionByZeroException::divisionByZero();
        }

        $p = $this->valueWithMinScale($that->scale);
        $q = $that->valueWithMinScale($this->scale);

        $remainder = Calculator::get()->divR($p, $q);

        $scale = $this->scale > $that->scale ? $this->scale : $that->scale;

        return new BigDecimal($remainder, $scale);
    }
public function remainder($that) : BigDecimal
    {
        $that = BigDecimal::of($that);

        if ($that->isZero()) {
            throw DivisionByZeroException::divisionByZero();
        }

        $p = $this->valueWithMinScale($that->scale);
        $q = $that->valueWithMinScale($this->scale);

        $remainder = Calculator::get()->divR($p, $q);

        $scale = $this->scale > $that->scale ? $this->scale : $that->scale;

        return new BigDecimal($remainder, $scale);
    }
public function remainder ( $ that ) : BigDecimal { $ that = BigDecimal :: of ( $ that ) ; if ( $ that -> isZero ( ) ) { throw DivisionByZeroException :: divisionByZero ( ) ; } $ p = $ this -> valueWithMinScale ( $ that -> scale ) ; $ q = $ that -> valueWithMinScale ( $ this -> scale ) ; $ remainder = Calculator :: get ( ) -> divR ( $ p , $ q ) ; $ scale = $ this -> scale > $ that -> scale ? $ this -> scale : $ that -> scale ; return new BigDecimal ( $ remainder , $ scale ) ; }
Returns the remainder of the division of this number by this given one.

The remainder has a scale of `max($this->scale, $that->scale)`.

@param BigNumber|number|string $that The divisor. Must be convertible to a BigDecimal.

@return BigDecimal The remainder.

@throws MathException If the divisor is not a valid decimal number, or is zero.
Returns the remainder of the division of this number by this given one .