/** * Useful for payment systems that don't use high precision * * @param int $roundingMode * @return Decimal */ public function toUnits($roundingMode = self::ROUND_HALF_UP) { $this->assertRoundingMode($roundingMode); $precision = $this->getPrecision(); if (null === $roundingMode) { return $this->amount->round($precision); } return Math::bcround($this->amount, $precision, $roundingMode); }