You are here

public static function PHPExcel_Calculation_Engineering::IMARGUMENT in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php \PHPExcel_Calculation_Engineering::IMARGUMENT()

* IMARGUMENT * * Returns the argument theta of a complex number, i.e. the angle in radians from the real * axis to the representation of the number in polar coordinates. * * Excel Function: * IMARGUMENT(complexNumber) * *

Parameters

string $complexNumber The complex number for which you want the argument theta.: * @return float

3 calls to PHPExcel_Calculation_Engineering::IMARGUMENT()
PHPExcel_Calculation_Engineering::IMLN in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
* IMLN * * Returns the natural logarithm of a complex number in x + yi or x + yj text format. * * Excel Function: * IMLN(complexNumber) * *
PHPExcel_Calculation_Engineering::IMPOWER in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
* IMPOWER * * Returns a complex number in x + yi or x + yj text format raised to a power. * * Excel Function: * IMPOWER(complexNumber,realNumber) * *
PHPExcel_Calculation_Engineering::IMSQRT in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
* IMSQRT * * Returns the square root of a complex number in x + yi or x + yj text format. * * Excel Function: * IMSQRT(complexNumber) * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php, line 1750

Class

PHPExcel_Calculation_Engineering
PHPExcel_Calculation_Engineering

Code

public static function IMARGUMENT($complexNumber) {
  $complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
  $parsedComplex = self::_parseComplex($complexNumber);
  if ($parsedComplex['real'] == 0.0) {
    if ($parsedComplex['imaginary'] == 0.0) {
      return 0.0;
    }
    elseif ($parsedComplex['imaginary'] < 0.0) {
      return M_PI / -2;
    }
    else {
      return M_PI / 2;
    }
  }
  elseif ($parsedComplex['real'] > 0.0) {
    return atan($parsedComplex['imaginary'] / $parsedComplex['real']);
  }
  elseif ($parsedComplex['imaginary'] < 0.0) {
    return 0 - (M_PI - atan(abs($parsedComplex['imaginary']) / abs($parsedComplex['real'])));
  }
  else {
    return M_PI - atan($parsedComplex['imaginary'] / abs($parsedComplex['real']));
  }
}