/**
  * Create complex type from polar co-ordinates - GMP version
  *
  * @param \Chippyash\Type\Number\Rational\GMPRationalType $radius
  * @param \Chippyash\Type\Number\Rational\GMPRationalType $theta angle expressed in radians
  *
  * @return \Chippyash\Type\Number\Complex\GMPComplexType
  *
  * @codeCoverageIgnore
  */
 public static function fromGmpPolar(GMPRationalType $radius, GMPRationalType $theta)
 {
     $cos = RationalTypeFactory::fromFloat(cos($theta()));
     $sin = RationalTypeFactory::fromFloat(sin($theta()));
     //real = radius * cos
     $rNum = TypeFactory::create('int', gmp_strval(gmp_mul($radius->numerator()->gmp(), $cos->numerator()->gmp())));
     $rDen = TypeFactory::create('int', gmp_strval(gmp_mul($radius->denominator()->gmp(), $cos->denominator()->gmp())));
     //imag = radius * sin
     $iNum = TypeFactory::create('int', gmp_strval(gmp_mul($radius->numerator()->gmp(), $sin->numerator()->gmp())));
     $iDen = TypeFactory::create('int', gmp_strval(gmp_mul($radius->denominator()->gmp(), $sin->denominator()->gmp())));
     return new GMPComplexType(RationalTypeFactory::create($rNum, $rDen), RationalTypeFactory::create($iNum, $iDen));
 }
 public function testNegativeDenominatorNormalizesToNegativeNumerator()
 {
     $r = new GMPRationalType(new GMPIntType(4), new GMPIntType(-3));
     $this->assertEquals(-4, $r->numerator()->get());
     $this->assertEquals(3, $r->denominator()->get());
 }