/** * Returns a Complex given polar coordinates. * * @param float $modulus * @param float $argument * * @return Complex */ public static function fromPolar(Real $modulus, Real $argument) { $realValue = $modulus->toNative() * \cos($argument->toNative()); $imValue = $modulus->toNative() * \sin($argument->toNative()); $real = new Real($realValue); $im = new Real($imValue); $complex = new self($real, $im); return $complex; }
public function testToNative() { $real = new Real(3.4); $this->assertEquals(3.4, $real->toNative()); }
/** * Returns the value of the integer number. * * @return int */ public function toNative() { $value = parent::toNative(); return \intval($value); }