ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
exp.php
Go to the documentation of this file.
1 <?php
2 
10 namespace Complex;
11 
19 if (!function_exists(__NAMESPACE__ . '\\exp')) {
20  function exp($complex): Complex
21  {
22  $complex = Complex::validateComplexArgument($complex);
23 
24  if (($complex->getReal() == 0.0) && (\abs($complex->getImaginary()) == M_PI)) {
25  return new Complex(-1.0, 0.0);
26  }
27 
28  $rho = \exp($complex->getReal());
29 
30  return new Complex(
31  $rho * \cos($complex->getImaginary()),
32  $rho * \sin($complex->getImaginary()),
33  $complex->getSuffix()
34  );
35  }
36 }