isInfinite() public method

public isInfinite ( ) : boolean
return boolean
コード例 #1
0
 /**
  * Powers this value to $b
  *
  * @param  Decimal  $b      exponent
  * @param  integer  $scale
  * @return Decimal
  */
 public function pow(Decimal $b, $scale = null)
 {
     if ($b->isPositive()) {
         if ($this->isPositive()) {
             return $this;
         }
         // if ($this->isNegative())
         if ($b->isInfinite()) {
             throw new \DomainException("Negative infinite elevated to infinite is undefined.");
         }
         if ($b->isInteger()) {
             if (preg_match('/^[+\\-]?[0-9]*[02468](\\.0+)?$/', $b->value, $captures) === 1) {
                 // $b is an even number
                 return self::$pInf;
             } else {
                 // $b is an odd number
                 return $this;
                 // Negative Infinite
             }
         }
         throw new NotImplementedException("See issues #21, #22, #23 and #24 on Github.");
     } else {
         if ($b->isNegative()) {
             return DecimalConstants::Zero();
         } else {
             if ($b->isZero()) {
                 throw new \DomainException("Infinite elevated to zero is undefined.");
             }
         }
     }
 }