Fix `IMSQRT()` tests on PHP 7.1

This commit is contained in:
Adrien Crivelli 2016-12-14 22:59:45 +09:00
parent 03f96ab6d8
commit 0de994c998
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
1 changed files with 4 additions and 0 deletions

View File

@ -1985,6 +1985,10 @@ class Engineering
$parsedComplex = self::parseComplex($complexNumber); $parsedComplex = self::parseComplex($complexNumber);
$theta = self::IMARGUMENT($complexNumber); $theta = self::IMARGUMENT($complexNumber);
if ($theta === functions::DIV0()) {
return '0';
}
$d1 = cos($theta / 2); $d1 = cos($theta / 2);
$d2 = sin($theta / 2); $d2 = sin($theta / 2);
$r = sqrt(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary']))); $r = sqrt(sqrt(($parsedComplex['real'] * $parsedComplex['real']) + ($parsedComplex['imaginary'] * $parsedComplex['imaginary'])));