public static function PHPExcel_Calculation_Engineering::IMSQRT 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::IMSQRT()
* IMSQRT * * Returns the square root of a complex number in x + yi or x + yj text format. * * Excel Function: * IMSQRT(complexNumber) * *
Parameters
string $complexNumber The complex number for which you want the square root.: * @return string
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Engineering.php, line 1860
Class
- PHPExcel_Calculation_Engineering
- PHPExcel_Calculation_Engineering
Code
public static function IMSQRT($complexNumber) {
$complexNumber = PHPExcel_Calculation_Functions::flattenSingleValue($complexNumber);
$parsedComplex = self::_parseComplex($complexNumber);
$theta = self::IMARGUMENT($complexNumber);
$d1 = cos($theta / 2);
$d2 = sin($theta / 2);
$r = sqrt(sqrt($parsedComplex['real'] * $parsedComplex['real'] + $parsedComplex['imaginary'] * $parsedComplex['imaginary']));
if ($parsedComplex['suffix'] == '') {
return self::COMPLEX($d1 * $r, $d2 * $r);
}
else {
return self::COMPLEX($d1 * $r, $d2 * $r, $parsedComplex['suffix']);
}
}