You are here

public static function PHPExcel_Calculation_Engineering::IMPRODUCT in Loft Data Grids 7.2

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

* IMPRODUCT * * Returns the product of two or more complex numbers in x + yi or x + yj text format. * * Excel Function: * IMPRODUCT(complexNumber[,complexNumber[,...]]) * *

Parameters

string $complexNumber,... Series of complex numbers to multiply: * @return string

2 calls to PHPExcel_Calculation_Engineering::IMPRODUCT()
PHPExcel_Calculation_Engineering::IMLOG10 in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
* IMLOG10 * * Returns the common logarithm (base 10) of a complex number in x + yi or x + yj text format. * * Excel Function: * IMLOG10(complexNumber) * *
PHPExcel_Calculation_Engineering::IMLOG2 in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
* IMLOG2 * * Returns the base-2 logarithm of a complex number in x + yi or x + yj text format. * * Excel Function: * IMLOG2(complexNumber) * *

File

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

Class

PHPExcel_Calculation_Engineering
PHPExcel_Calculation_Engineering

Code

public static function IMPRODUCT() {

  // Return value
  $returnValue = self::_parseComplex('1');
  $activeSuffix = '';

  // Loop through the arguments
  $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
  foreach ($aArgs as $arg) {
    $parsedComplex = self::_parseComplex($arg);
    $workValue = $returnValue;
    if ($parsedComplex['suffix'] != '' && $activeSuffix == '') {
      $activeSuffix = $parsedComplex['suffix'];
    }
    elseif ($parsedComplex['suffix'] != '' && $activeSuffix != $parsedComplex['suffix']) {
      return PHPExcel_Calculation_Functions::NaN();
    }
    $returnValue['real'] = $workValue['real'] * $parsedComplex['real'] - $workValue['imaginary'] * $parsedComplex['imaginary'];
    $returnValue['imaginary'] = $workValue['real'] * $parsedComplex['imaginary'] + $workValue['imaginary'] * $parsedComplex['real'];
  }
  if ($returnValue['imaginary'] == 0.0) {
    $activeSuffix = '';
  }
  return self::COMPLEX($returnValue['real'], $returnValue['imaginary'], $activeSuffix);
}