Returns a new Money object that represents
the multiplied value by the given factor

@param numeric $multiplier
@param int $roundingMode
@return Money
177512
public function multiply($multiplier, $roundingMode = self::ROUND_HALF_UP, $precision = self::PRECISION_GAAP)
    {
        $this->assertRoundingMode($roundingMode);
        $multiplier = $this->castOperand($multiplier);
        $precision  = $this->castPrecision($precision);

        $amount = $this->amount->mul($multiplier, $this->getInnerPrecision() + 1);

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

        return $this->newInstance($amount);
    }
1171784
private function createMoney($amount, $currency) { $precision = isset($this->config[$currency]) ? $this->config[$currency]['precision'] : 2;
        return new Money($amount, new Currency($currency, $precision));
    }
654207
@Override
    public RoundedMoney scaleByPowerOfTen(int power) {
        return new RoundedMoney(number.scaleByPowerOfTen(power), currency, rounding);
    }
664724
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();
    }
848549
@Override
    public RoundedMoney scaleByPowerOfTen(int n) {
        return new RoundedMoney(number.scaleByPowerOfTen(n), currency, rounding);
    }
1105165
public function divide($divisor, $roundingMode = self::ROUND_HALF_UP)
    {
        $this->assertOperand($divisor);
        $this->assertRoundingMode($roundingMode);

        if ($divisor == 0) {
            throw new InvalidArgumentException('Division by zero');
        }

        return new self(round($this->amount / $divisor, $this->currency->getPrecision(), $roundingMode), $this->currency);
    }
972056
public static final Function<Number,BigDecimal> toBigDecimal(final int scale, final RoundingMode roundingMode) {
        return new ToBigDecimal(scale, roundingMode);
    }
1128996
public function multiply(Real $multiplier, RoundingMode $rounding_mode = null)
    {
        if (null === $rounding_mode) {
            $rounding_mode = RoundingMode::HALF_UP();
        }

        $amount        = $this->getAmount()->toNative() * $multiplier->toNative();
        $roundedAmount = new Integer(round($amount, 0, $rounding_mode->toNative()));
        $result        = new self($roundedAmount, $this->getCurrency());

        return $result;
    }
715510
public function round(int $precision = 0, ?RoundingMode $roundingMode = null): FloatObject
    {
        if ($roundingMode === null) {
            $roundingMode = RoundingMode::HALF_UP();
        }

        return new static((float) round($this->value, $precision, $roundingMode->value()));
    }
509104
public final static Function<Short, Short> divideBy(float divisor, RoundingMode roundingMode) {
        return divideBy(Float.valueOf(divisor), roundingMode);
    }
1306379
private function assertRoundingMode($roundingMode)
    {
        if ($roundingMode !== null && !in_array($roundingMode, $this->roundingModes)) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Rounding mode should be %s',
                implode(' | ', array_map(
                    function($constant) {
                        return __CLASS__ . '::' . $constant;
                    },
                    array_keys($this->roundingModes)
                ))
            ));
        }
    }
618220
@Override
    public RoundedMoney subtract(MonetaryAmount amount) {
        MoneyUtils.checkAmountParameter(amount, currency);
        if (amount.isZero()) {
            return this;
        }
        return new RoundedMoney(number.subtract(amount.getNumber().numberValue(BigDecimal.class),
                Optional.ofNullable(
                        monetaryContext.get(MathContext.class)).orElse(MathContext.DECIMAL64)),
                currency, rounding);
    }
491636
@Override
    public RoundedMoney negate() {
        MathContext mc = monetaryContext.get(MathContext.class);
        if(mc==null){
            mc = MathContext.DECIMAL64;
        }
        return new RoundedMoney(number.negate(mc),
                currency, rounding);
    }
821032
public RoundedMoney pow(int n) {
        return new RoundedMoney(number.pow(n, Optional.ofNullable(
                monetaryContext.get(MathContext.class)).orElse(MathContext.DECIMAL64)),
                currency, rounding).with(rounding);
    }
1179488
public static double div(float v1, float v2, int scale, RoundingMode roundingMode) {
		return div(Float.toString(v1), Float.toString(v2), scale, roundingMode).doubleValue();
	}
718490
public function amount($decimal, $currency_code = null, $round = true)
    {
        static $factors = array();

        if (empty($currency_code)) {
            $currency_code = $this->currency->getDefault();
        }

        if (empty($factors[$currency_code])) {
            $currency = $this->currency->get($currency_code);
            $factors[$currency_code] = pow(10, $currency['decimals']);
        }

        if ($round) {
            $currency = $this->currency->get($currency_code);
            $decimal = $this->round($decimal, $currency);
            return (int) round($decimal * $factors[$currency_code]);
        }

        return $decimal * $factors[$currency_code];
    }
22090
public function multipliedBy($multValue)
    {
        if ($multValue <= 0) {
            throw new \InvalidArgumentException(
                'A quantity cannot be multiplied by zero or a negative value');
        }
        $newValue = $this->value * $multValue;

        return new self($this->uom, $newValue);
    }