示例#1
0
 public function testDiv()
 {
     parent::testDiv();
     $this->given($a = $this->fromNative($this->randomNativeNumber()), $b = $this->fromNative($this->randomNativeNumber()))->when($c = $a->div($b->toInteger()))->then->object($c)->isInstanceOf(Real::class);
 }
示例#2
0
 public function testPow()
 {
     parent::testPow();
     $this->given($a = $this->fromNative($this->randomNativeNumber()), $b = $this->fromNative($this->randomNativeNumber()))->when($c = $a->pow($b))->then->object($c)->isInstanceOf(Decimal::class);
     $this->given($positiveInfinite = $this->fromNative($this->positiveInfiniteNativeNumber()), $negativeInfinite = $this->fromNative($this->negativeInfiniteNativeNumber()), $number = $this->fromNative($this->randomNativeNumber()), $zero = $this->fromNative(0))->then->exception(function () use($positiveInfinite, $zero) {
         $positiveInfinite->pow($zero);
     })->isInstanceOf(NotImplementedException::class)->exception(function () use($positiveInfinite, $negativeInfinite) {
         $negativeInfinite->pow($positiveInfinite);
     })->isInstanceOf(\DomainException::class)->exception(function () use($negativeInfinite, $number) {
         $negativeInfinite->powReal($number->toReal());
     })->isInstanceOf(NotImplementedException::class);
 }