mul() public method

Multiplies two BigNumber objects
public mul ( Decimal $b, integer $scale = null ) : Decimal
$b Decimal
$scale integer
return Decimal
コード例 #1
0
ファイル: Money.php プロジェクト: coolms/money
 /**
  * @param CurrencyInterface $targetCurrency
  * @param float|int $exchangeRate
  * @param int $roundingMode
  * @return Money
  */
 public function exchange(CurrencyInterface $targetCurrency, $exchangeRate, $roundingMode = self::ROUND_HALF_UP)
 {
     $this->assertRoundingMode($roundingMode);
     $exchangeRate = $this->castOperand($exchangeRate);
     $amount = $this->amount->mul($exchangeRate, $this->getInnerPrecision());
     return new static($amount, $targetCurrency);
 }
コード例 #2
0
 private function floorModulo(Decimal $x, Decimal $y) : Decimal
 {
     return $x->sub($y->mul($x->div($y)->floor()));
 }