/** * Compare to amount * * @param Amount $amount * @param int $precision Optional decimal precision used in calculation * @return int 0 if instance and $amount are equal, 1 if instance is larger, -1 otherwise. */ public function compareTo(Amount $amount, $precision = -1) { return bccomp($this->getAmount(), $amount->getAmount(), $precision >= 0 ? $precision : $this->getInternalPrecision()); }