isComplex() && $complex->isComplex() && $result->getSuffix() !== $complex->getSuffix()) { throw new Exception('Suffix Mismatch'); } $real = ($result->getReal() * $complex->getReal()) - ($result->getImaginary() * $complex->getImaginary()); $imaginary = ($result->getReal() * $complex->getImaginary()) + ($result->getImaginary() * $complex->getReal()); $result = new Complex( $real, $imaginary, ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) ); } return $result; } }