示例#1
0
 /**
  * @param \Cubiche\Domain\System\Number $x
  *
  * @throws \DomainException
  *
  * @return static|null
  */
 protected function divSpecialCases(Number $x)
 {
     if ($x->isZero()) {
         throw new \DomainException('Division by zero is not allowed.');
     }
     if (($this->isZero() || $x->isInfinite()) && !$this->isInfinite()) {
         return static::fromNative(0);
     }
     return;
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function mult(Number $x)
 {
     if ($x->isZero()) {
         throw new \DomainException('The mult operation is not defined between "INF" and zero');
     }
     if ($this->isPositive() === $x->isPositive()) {
         return self::infPositive();
     }
     return self::infNegative();
 }