public static function PHPExcel_Calculation_Engineering::_parseComplex in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php \PHPExcel_Calculation_Engineering::_parseComplex()
* _parseComplex * * Parses a complex number into its real and imaginary parts, and an I or J suffix * *
Parameters
string $complexNumber The complex number: * @return string[] Indexed on "real", "imaginary" and "suffix"
17 calls to PHPExcel_Calculation_Engineering::_parseComplex()
- PHPExcel_Calculation_Engineering::IMABS in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Engineering.php - * IMABS * * Returns the absolute value (modulus) of a complex number in x + yi or x + yj text format. * * Excel Function: * IMABS(complexNumber) * *
- PHPExcel_Calculation_Engineering::IMAGINARY in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Engineering.php - * IMAGINARY * * Returns the imaginary coefficient of a complex number in x + yi or x + yj text format. * * Excel Function: * IMAGINARY(complexNumber) * * @access public * @category Engineering Functions *
- PHPExcel_Calculation_Engineering::IMARGUMENT in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Engineering.php - * 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) * *
- PHPExcel_Calculation_Engineering::IMCONJUGATE in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Engineering.php - * IMCONJUGATE * * Returns the complex conjugate of a complex number in x + yi or x + yj text format. * * Excel Function: * IMCONJUGATE(complexNumber) * *
- PHPExcel_Calculation_Engineering::IMCOS in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Engineering.php - * IMCOS * * Returns the cosine of a complex number in x + yi or x + yj text format. * * Excel Function: * IMCOS(complexNumber) * *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Engineering.php, line 696
Class
- PHPExcel_Calculation_Engineering
- PHPExcel_Calculation_Engineering
Code
public static function _parseComplex($complexNumber) {
$workString = (string) $complexNumber;
$realNumber = $imaginary = 0;
// Extract the suffix, if there is one
$suffix = substr($workString, -1);
if (!is_numeric($suffix)) {
$workString = substr($workString, 0, -1);
}
else {
$suffix = '';
}
// Split the input into its Real and Imaginary components
$leadingSign = 0;
if (strlen($workString) > 0) {
$leadingSign = $workString[0] == '+' || $workString[0] == '-' ? 1 : 0;
}
$power = '';
$realNumber = strtok($workString, '+-');
if (strtoupper(substr($realNumber, -1)) == 'E') {
$power = strtok('+-');
++$leadingSign;
}
$realNumber = substr($workString, 0, strlen($realNumber) + strlen($power) + $leadingSign);
if ($suffix != '') {
$imaginary = substr($workString, strlen($realNumber));
if ($imaginary == '' && ($realNumber == '' || $realNumber == '+' || $realNumber == '-')) {
$imaginary = $realNumber . '1';
$realNumber = '0';
}
else {
if ($imaginary == '') {
$imaginary = $realNumber;
$realNumber = '0';
}
elseif ($imaginary == '+' || $imaginary == '-') {
$imaginary .= '1';
}
}
}
return array(
'real' => $realNumber,
'imaginary' => $imaginary,
'suffix' => $suffix,
);
}