| @@ -175,10 +175,13 @@ | ||
| 175 | 175 | // We've been given a string to parse to extract the real and imaginary parts, and any suffix |
| 176 | 176 | list($realPart, $imaginaryPart, $suffix) = self::parseComplex($realPart); |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | - if ($imaginaryPart <> 0.0 && empty($suffix)) { | |
| 179 | + | |
| 180 | + if ($imaginaryPart != 0.0 && empty($suffix)) { | |
| 180 | 181 | $suffix = 'i'; |
| 182 | + } elseif ($imaginaryPart == 0.0 && !empty($suffix)) { | |
| 183 | + $suffix = ''; | |
| 181 | 184 | } |
| 182 | 185 | |
| 183 | 186 | // Set parsed values in our properties |
| 184 | 187 | $this->realPart = (float) $realPart; |