@param Decimal $that

@return bool

@throws \RangeException If the result exceeds the size of an int on this platform.
549119
public function isDivisibleBy(Decimal $that) : bool
    {
        $this->scaleValues($this, $that, $a, $b);

        return $a % $b === 0;
    }
728643
public function Compare( $other )
	{
		// BMS 2019-04-28
		// Probably need to do this for all other numeric types and the boolean
	    switch ( $other->GetValueCode() )
	    {
			case DecimalProxyFactory::Code:
				return 1;

	    	case StringProxyFactory::Code:
				return 0;

	        default:
	        	return -2;
	    }

		if ( $other->GetValueCode() == StringProxyFactory::Code )
	        return 0;
	    return -2;
	}
697832
public function pow(Decimal $b, int $scale = null): Decimal
    {
        if ($this->isZero()) {
            if ($b->isPositive()) {
                return Decimal::fromDecimal($this, $scale);
            } else {
                throw new \DomainException("zero can't be powered to zero or negative numbers.");
            }
        } elseif ($b->isZero()) {
            return DecimalConstants::One();
        } else if ($b->isNegative()) {
            return DecimalConstants::One()->div(
                $this->pow($b->additiveInverse(), max($scale, self::DEFAULT_SCALE)),
                max($scale, self::DEFAULT_SCALE)
            );
        } elseif (0 === $b->scale) {
            $pow_scale = \max($this->scale, $b->scale, $scale ?? 0);

            return self::fromString(
                \bcpow($this->value, $b->value, $pow_scale+1),
                $pow_scale
            );
        } else {
            if ($this->isPositive()) {
                $pow_scale = \max($this->scale, $b->scale, $scale ?? 0);

                $truncated_b = \bcadd($b->value, '0', 0);
                $remaining_b = \bcsub($b->value, $truncated_b, $b->scale);

                $first_pow_approx = \bcpow($this->value, $truncated_b, $pow_scale+1);
                $intermediate_root = self::innerPowWithLittleExponent(
                    $this->value,
                    $remaining_b,
                    $b->scale,
                    $pow_scale+1
                );

                return Decimal::fromString(
                    \bcmul($first_pow_approx, $intermediate_root, $pow_scale+1),
                    $pow_scale
                );
            } else { // elseif ($this->isNegative())
                if (!$b->isInteger()) {
                    throw new NotImplementedError(
                        "Usually negative numbers can't be powered to non integer numbers. " .
                        "The cases where is possible are not implemented."
                    );
                }

                return (\preg_match('/^[+\-]?[0-9]*[02468](\.0+)?$/', $b->value, $captures) === 1)
                    ? $this->additiveInverse()->pow($b, $scale)                      // $b is an even number
                    : $this->additiveInverse()->pow($b, $scale)->additiveInverse();  // $b is an odd number
            }
        }
    }
637212
public function subtotal($decimals = null, $decimalPoint = null, $thousandSeperator = null)
    {
        return $this->numberFormat($this->subtotal, $decimals, $decimalPoint, $thousandSeperator);
    }
752005
public function gte($number)
    {
        return (bool) (bccomp($this->number, static::validateInputNumber($number), $this->precision) >= 0);
    }
680391
public function hasRange()
    {
        return ($this->getOffset() !== false && $this->getOffset() >= 0 && $this->getNumberOfEntries() !== false && $this->getNumberOfEntries() > 0);
    }
558958
public function containsRange(RangeInterface $range)
    {
        $result = false;
        if ($range->getAddressType() === $this->getAddressType()) {
            if ($range->toString(false) === $this->toString(false)) {
                $result = true;
            }
        }

        return $result;
    }
843187
public function taxTotal($decimals = null, $decimalPoint = null, $thousandSeperator = null)
    {
        return $this->numberFormat($this->taxTotal, $decimals, $decimalPoint, $thousandSeperator);
    }
1262663
public function minus(Decimal $that) : Decimal
    {
        $this->scaleValues($this, $that, $a, $b);

        $value = $a - $b;

        if (is_float($value)) {
            throw new \RangeException('The subtraction result overflows.');
        }

        $scale = max($this->scale, $that->scale);

        while ($scale !== 0) {
            if ($value % 10 !== 0) {
                break;
            }

            $value /= 10;
            $scale--;
        }

        return new Decimal($value, $scale);
    }
43633
private static function getDecimalPrecision($value)
    {
        $lc = localeconv();

        $decimal_pos = mb_strpos((string) $value, $lc['decimal_point']);

        return $decimal_pos !== false
            ? mb_strlen($value) - $decimal_pos - mb_strlen($lc['decimal_point'])
            : 0;
    }
287355
@Override
	public int compareNumericallyTo(BitStore that) {
		if (that == null) throw new IllegalArgumentException("null that");
		return that.zeros().isAll() ? 0 : -1;
	}
925291
public function remainder($that) : BigInteger
    {
        $that = BigInteger::of($that);

        if ($that->value === '0') {
            throw DivisionByZeroException::divisionByZero();
        }

        $remainder = Calculator::get()->divR($this->value, $that->value);

        return new BigInteger($remainder);
    }
542938
public static function mathSubtract($decimal1, $decimal2) {
        if (!is_numeric($decimal1)) {
            throw new Exception("decimal1 is not a numeric value: " . $decimal1);
        }

        if (!is_numeric($decimal2)) {
            throw new Exception("decimal2 is not a numeric value: " . $decimal2);
        }

        return round($decimal1 - $decimal2, StaticEb::$roundPrecision);
    }
192388
public function isEqualTo(LocalDateRange $that) : bool
    {
        return $this->startDate->isEqualTo($that->startDate)
            && $this->endDate->isEqualTo($that->endDate);
    }
1331105
public function divide($divisor, $roundingMode = self::ROUND_HALF_UP, $precision = self::PRECISION_GAAP)
    {
        $this->assertRoundingMode($roundingMode);
        $divisor = $this->castOperand($divisor);
        $precision = $this->castPrecision($precision);

        $innerPrecision = $this->getInnerPrecision();
        if ($divisor->isZero($innerPrecision)) {
            throw new Exception\InvalidArgumentException('Division by zero');
        }

        $amount = $this->amount->div($divisor, $innerPrecision + 1);

        if (null === $roundingMode) {
            $amount = $amount->round($precision);
        } else {
            $amount = Math::bcround($amount, $precision, $roundingMode);
        }

        return $this->newInstance($amount);
    }
236260
public static function max($array = false, $decimals = 3) {

        if($array && Validate::isArray($array)) {

            return self::round(max($array), $decimals);
        }

        return false;
    }
372849
public function asFloat(NumberRange $range = null, int $decimals = null)
    {
        $this->reportError();
        return null;
    }