@param MoneyInterface $money
@param int $precision

@return MoneyInterface
760763
public function ceil(MoneyInterface $money, $precision = null)
    {
        if ($precision === null) {
            $precision = $this->informationProvider->getDefaultPrecision($money->getCurrency());
        }
        return $this->factory->create(
            $this->math->ceil($money->getAmount(), $precision),
            $money->getCurrency()
        );
    }
720285
public function add(Money $money1, Money $money2)
    {
        $this->checkCurrenciesMatch($money1, $money2);

        return new Money(
            $money1->getAmount() + $money2->getAmount(),
            $money1->getCurrency()
        );
    }
78129
public static function parseByBitcoin($money, $forceCurrency = null, $fractionDigits = 2)
    {
        $parser = new BitcoinMoneyParser($fractionDigits);

        return self::parseByParser($parser, $money, $forceCurrency);
    }
1092284
public function mul(MoneyInterface $money, $multiplier)
    {
        return $this->factory->create(
            $this->math->mul($money->getAmount(), $multiplier),
            $money->getCurrency()
        );
    }
1201016
public function fromFloat($amount, $currency = null)
    {
        if ($currency) {
            $this->setCurrency($currency);
        }

        if (!is_float($amount)) {
            throw new InvalidArgumentException(sprintf(
                'Amount must be a float, %s given',
                gettype($amount)
            ));
        }
        
        $this->amount = $this->toInt(
            round(
                $this->getSubUnit() * round($amount, $this->getFractionDigits(), PHP_ROUND_HALF_UP),
                0,
                PHP_ROUND_HALF_UP
            )
        );
        return $this;
    }
935880
public static function parse($money, $forceCurrency = null, $locale = null, Currencies $currencies = null)
    {
        return self::parseByIntl($money, $forceCurrency, $locale, $currencies);
    }
684096
public function formatMoney(Money $money, $decPoint = ',', $thousandsSep = ' ')
    {
        $symbol = $this->formatCurrency($money);
        $amount = $this->formatAmount($money, $decPoint, $thousandsSep);
        $price = $amount." ".$symbol;

        return $price;
    }
419173
public function exchange(Money $money, $targetCurrency)
    {
        if (is_string($targetCurrency)) {
            $targetCurrency = Currency::create($targetCurrency);
        }

        $exchangeRate = 0;
        return $money->exchange($targetCurrency, $exchangeRate);
    }
795191
public function subtract(Money $money) : Money
    {
        $this->verifySameCurrency(__METHOD__, $money);

        return $this->add($money->negate());
    }
1243294
public function compare(Money $money)
    {
        $this->assertSameCurrency($money);

        return $this->amount->comp($money->amount, $this->getInnerPrecision());
    }
988450
public function setPrice(\Elcodi\Component\Currency\Entity\Interfaces\MoneyInterface $amount)
    {
        $this->price = $amount->getAmount();
        $this->priceCurrency = $amount->getCurrency();

        return $this;
    }
909083
public function convert(Money $money, $roundingMode = Money::ROUND_HALF_UP)
    {
        if (!$money->getCurrency()->equals($this->baseCurrency)) {
            throw new InvalidArgumentException(
                sprintf('Currencies must match: Money to convert has currency %s, while CurrencyPair has base currency %s.',
                    $money->getCurrency()->getIsoCode(),
                    $this->baseCurrency->getIsoCode()
                )
            );
        }

        return new Money(
            Math::bcround(
                bcmul($money->getAmountString(), $this->ratio, Money::GAAP_PRECISION + 1),
                Money::GAAP_PRECISION,
                $roundingMode
            ),
            $this->counterCurrency
        );
    }
685858
public function getAmount(MoneyInterface $money = null, $currency = null)
    {
        if (null === $money) {
            return 0.0;
        }

        $reduced = $this->bank->reduce($money, $currency);

        return $reduced->getAmount();
    }
399258
public function setAmount(MoneyInterface $amount)
    {
        $this->amount = $amount->getAmount();
        $this->amountCurrency = $amount->getCurrency();

        return $this;
    }
63574
public static function parseByIntlLocalizedDecimal(
        $money,
        $forceCurrency,
        $locale = null,
        Currencies $currencies = null,
        $style = NumberFormatter::DECIMAL
    ) {
        $numberFormatter = new NumberFormatter($locale ?: static::getLocale(), $style);
        $parser = new IntlLocalizedDecimalParser($numberFormatter, $currencies ?: static::getCurrencies());

        return self::parseByParser($parser, $money, $forceCurrency);
    }
877840
public function convertAndFormat($money, $language = null, $currency = null)
    {
        if (!$currency) {
            $currency = $this->currencyCode;
        }

        $convertedMoney = $money->convertToCurrency($currency);

        return $this->intlFormatter($language)->format($convertedMoney);
    }
84908
public function asFloat(Money $money)
    {
        $amount = $money->getAmount();
        $amount = (float) $amount;
        $amount = $amount / pow(10, $this->decimals);

        return $amount;
    }