@param float $factor
@param int   $roundingMode

@return Money
@throws InvalidArgumentException
172205
public function multiply(float $factor, int $roundingMode) : Money
    {
        if (!in_array($roundingMode, self::$roundingModes, true)) {
            throw InvalidArgumentException::format(
                'Invalid rounding mode supplied to %s: expecting one of (%s), %s given',
                __METHOD__, Debug::formatValues(self::$roundingModes), $roundingMode
            );
        }

        return new Money((int)round($this->amount * $factor, 0, $roundingMode), $this->currency);
    }
347547
private function round($value, $precision)
    {
        $precision = $this->getUninitializedPrecision($value, $precision);

        $roundingModeAttribute = $this->getAttribute(self::ROUNDING_MODE);
        if (isset(self::$phpRoundingMap[$roundingModeAttribute])) {
            $value = round($value, $precision, self::$phpRoundingMap[$roundingModeAttribute]);
        } elseif (isset(self::$customRoundingList[$roundingModeAttribute])) {
            $roundingCoef = pow(10, $precision);
            $value *= $roundingCoef;
            $value = (float) (string) $value;

            switch ($roundingModeAttribute) {
                case self::ROUND_CEILING:
                    $value = ceil($value);
                    break;
                case self::ROUND_FLOOR:
                    $value = floor($value);
                    break;
                case self::ROUND_UP:
                    $value = $value > 0 ? ceil($value) : floor($value);
                    break;
                case self::ROUND_DOWN:
                    $value = $value > 0 ? floor($value) : ceil($value);
                    break;
            }

            $value /= $roundingCoef;
        }

        return $value;
    }
341087
public function round($value, $currency = null)
    {
        return round($value, $this->precision, $this->mode);
    }
308712
@Override
    public RoundedMoney remainder(Number divisor) {
        MathContext mc = monetaryContext.get(MathContext.class);
        if(mc==null){
            mc = MathContext.DECIMAL64;
        }
        return new RoundedMoney(number.remainder(MoneyUtils.getBigDecimal(divisor), mc),
                currency, rounding);
    }
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);
    }
256353
public static double round(double value, int decimals, RoundingMode roundingMode) {
		if (decimals < 0) {
			throw new IllegalArgumentException("Invalid number of decimal places");
		}

		BigDecimal bd = new BigDecimal(value);
		return bd.setScale(decimals, roundingMode).doubleValue();
	}
659355
function round (amount, numOfDecDigits) {
        numOfDecDigits = numOfDecDigits || 2;
        return Math.round(amount * Math.pow(10, numOfDecDigits)) / Math.pow(10, numOfDecDigits);
    }
939971
public function multiply($multiplier, $roundingMode = self::ROUND_HALF_UP)
    {
        return new self(round($this->amount * $multiplier, $this->currency->getPrecision(), $roundingMode), $this->currency);
    }
886550
public BigDecimal compute(int scale, RoundingMode mode) {
    return numerator.divide(denominator, scale, mode).stripTrailingZeros();
  }
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();
    }
450813
public static String roundStr(double v, int scale, RoundingMode roundingMode) {
		return round(v, scale, roundingMode).toString();
	}
49225
public static function Factorial($num) {
		if ($num < 0) throw new \InvalidArgumentException("Fatorial calls should be >0.");

		$rval=1;
		for ($i = 1; $i <= $num; $i++)
			$rval = $rval * $i;
		return $rval;
	}
1066628
public static int divide(int p, int q, RoundingMode mode) {
		return IntMath.divide(p, q, mode);
	}
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()));
    }
1150929
@Override
    public RoundedMoney divideToIntegralValue(Number divisor) {
        MathContext mc = monetaryContext.get(MathContext.class);
        if(mc==null){
            mc = MathContext.DECIMAL64;
        }
        BigDecimal dec = number.divideToIntegralValue(MoneyUtils.getBigDecimal(divisor), mc);
        return new RoundedMoney(dec, currency, rounding);
    }
1015781
public function getAmountBasic($roundingMode = self::ROUND_HALF_UP)
    {
        return Math::bcround($this->amount, self::BASIC_PRECISION, $roundingMode);
    }
411991
public function computeUsingBcMath(DecimalNumber $a, DecimalNumber $b, $precision = self::DEFAULT_PRECISION)
    {
        if ((string) $b === '0') {
            throw new DivisionByZeroException();
        }

        return new DecimalNumber((string) bcdiv($a, $b, $precision));
    }