#401 : PHPUnit Fixes (Calculation > Engineering)
This commit is contained in:
parent
248bdbf841
commit
20d007abb1
|
@ -772,11 +772,10 @@ class Engineering
|
||||||
|
|
||||||
$realNumber = substr($workString, 0, strlen($realNumber) + strlen($power) + $leadingSign);
|
$realNumber = substr($workString, 0, strlen($realNumber) + strlen($power) + $leadingSign);
|
||||||
|
|
||||||
//if ($suffix != '') {
|
if ($suffix != '') {
|
||||||
$imaginary = substr($workString, strlen($realNumber));
|
$imaginary = substr($workString, strlen($realNumber));
|
||||||
if ($imaginary == false) {
|
|
||||||
$imaginary = '';
|
if (($imaginary == '') && (($realNumber == '') || ($realNumber == '+') || ($realNumber == '-'))) {
|
||||||
} elseif (($imaginary == '') && (($realNumber == '') || ($realNumber == '+') || ($realNumber == '-'))) {
|
|
||||||
$imaginary = $realNumber . '1';
|
$imaginary = $realNumber . '1';
|
||||||
$realNumber = '0';
|
$realNumber = '0';
|
||||||
} elseif ($imaginary == '') {
|
} elseif ($imaginary == '') {
|
||||||
|
@ -785,7 +784,7 @@ class Engineering
|
||||||
} elseif (($imaginary == '+') || ($imaginary == '-')) {
|
} elseif (($imaginary == '+') || ($imaginary == '-')) {
|
||||||
$imaginary .= '1';
|
$imaginary .= '1';
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'real' => $realNumber,
|
'real' => $realNumber,
|
||||||
|
@ -2192,12 +2191,9 @@ class Engineering
|
||||||
$parsedComplexDividend = self::parseComplex($complexDividend);
|
$parsedComplexDividend = self::parseComplex($complexDividend);
|
||||||
$parsedComplexDivisor = self::parseComplex($complexDivisor);
|
$parsedComplexDivisor = self::parseComplex($complexDivisor);
|
||||||
|
|
||||||
if (($parsedComplexDividend['suffix'] != '' && $parsedComplexDivisor['suffix'] != '') && ($parsedComplexDividend['suffix'] != $parsedComplexDivisor['suffix'])) {
|
if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] != '') &&
|
||||||
return Functions::NAN();
|
($parsedComplexDividend['suffix'] != $parsedComplexDivisor['suffix'])
|
||||||
}
|
) {
|
||||||
if ((($parsedComplexDividend['suffix'] != '' && $parsedComplexDivisor['imaginary'] != '')
|
|
||||||
|| ($parsedComplexDivisor['suffix'] != '' && $parsedComplexDividend['imaginary'] != ''))
|
|
||||||
&& ($parsedComplexDividend['suffix'] != $parsedComplexDivisor['suffix'])) {
|
|
||||||
return Functions::NAN();
|
return Functions::NAN();
|
||||||
}
|
}
|
||||||
if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] == '')) {
|
if (($parsedComplexDividend['suffix'] != '') && ($parsedComplexDivisor['suffix'] == '')) {
|
||||||
|
@ -2245,13 +2241,7 @@ class Engineering
|
||||||
($parsedComplex1['suffix'] != $parsedComplex2['suffix'])
|
($parsedComplex1['suffix'] != $parsedComplex2['suffix'])
|
||||||
) {
|
) {
|
||||||
return Functions::NAN();
|
return Functions::NAN();
|
||||||
}
|
} elseif (($parsedComplex1['suffix'] == '') && ($parsedComplex2['suffix'] != '')) {
|
||||||
if ((($parsedComplex1['suffix'] != '' && $parsedComplex2['imaginary'] != '')
|
|
||||||
|| ($parsedComplex2['suffix'] != '' && $parsedComplex1['imaginary'] != ''))
|
|
||||||
&& ($parsedComplex1['suffix'] != $parsedComplex2['suffix'])) {
|
|
||||||
return Functions::NAN();
|
|
||||||
}
|
|
||||||
if (($parsedComplex1['suffix'] == '') && ($parsedComplex2['suffix'] != '')) {
|
|
||||||
$parsedComplex1['suffix'] = $parsedComplex2['suffix'];
|
$parsedComplex1['suffix'] = $parsedComplex2['suffix'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue