public function toSubunits($roundingMode = self::ROUND_HALF_UP)
    {
        $this->assertRoundingMode($roundingMode);

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

        $subunitToUnit = $this->currency->getSubunitToUnit();
        if ($subunitToUnit > 1) {
            $subunitToUnit = Decimal::create($subunitToUnit, $precision);
            $amount = $amount->mul($subunitToUnit, $precision);
        }

        return $amount->asInteger();
    }