public function testAsComplexReturnsComplexType() { $c = $this->object->asComplex(); $this->assertInstanceOf('\\Chippyash\\Type\\Number\\Complex\\ComplexType', $c); $this->assertEquals('3/4', (string) $c); $this->assertInstanceOf('Chippyash\\Type\\Number\\Rational\\RationalType', $c->r()); $this->assertInstanceOf('Chippyash\\Type\\Number\\Rational\\RationalType', $c->i()); }
/** * Construct new GMP rational * * @param GMPIntType $num numerator * @param GMPIntType $den denominator * @param \Chippyash\Type\BoolType $reduce -optional: default = true */ public function __construct(GMPIntType $num, GMPIntType $den, BoolType $reduce = null) { if ($reduce != null) { $this->reduce = $reduce(); } parent::__construct($num, $den); }