/** * 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 testToString() { $real = new Real(0.7); $this->assertEquals('.7', $real->__toString()); }
public function testGetArgument() { $arg = new Real(1.0010398733119); $this->assertTrue($arg->sameValueAs($this->complex->getArgument())); }
/** * Returns the value of the integer number. * * @return int */ public function toNative() { $value = parent::toNative(); return \intval($value); }