18 if (!function_exists(__NAMESPACE__ .
'\\subtract')) {
19 function subtract(...$complexValues):
Complex 21 if (count($complexValues) < 2) {
22 throw new \Exception(
'This function requires at least 2 arguments');
25 $base = array_shift($complexValues);
28 foreach ($complexValues as $complex) {
29 $complex = Complex::validateComplexArgument($complex);
31 if (
$result->isComplex() && $complex->isComplex() &&
32 $result->getSuffix() !== $complex->getSuffix()) {
36 $real =
$result->getReal() - $complex->getReal();
37 $imaginary =
$result->getImaginary() - $complex->getImaginary();
42 ($imaginary == 0.0) ? null : max(
$result->getSuffix(), $complex->getSuffix())