From 0de994c998f4e324070a7a978572109a022eaa7c Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Wed, 14 Dec 2016 22:59:45 +0900 Subject: [PATCH] Fix `IMSQRT()` tests on PHP 7.1 --- src/PhpSpreadsheet/Calculation/Engineering.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PhpSpreadsheet/Calculation/Engineering.php b/src/PhpSpreadsheet/Calculation/Engineering.php index 93848bf4..ff598ab4 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering.php +++ b/src/PhpSpreadsheet/Calculation/Engineering.php @@ -1985,6 +1985,10 @@ class Engineering $parsedComplex = self::parseComplex($complexNumber); $theta = self::IMARGUMENT($complexNumber); + if ($theta === functions::DIV0()) { + return '0'; + } + $d1 = cos($theta / 2); $d2 = sin($theta / 2); $r = sqrt(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])));