* Get the complex number as a string * @returns String representation of the complex number
()
| 214 | * @returns String representation of the complex number |
| 215 | */ |
| 216 | public toString(): string |
| 217 | { |
| 218 | if (Math.sign(this.img) === -1) |
| 219 | { |
| 220 | // bit of a dirty hack.. |
| 221 | return this.real + " - " + -this.img + "i"; |
| 222 | } |
| 223 | else |
| 224 | { |
| 225 | return this.real + " + " + this.img + "i"; |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Compare two complex numbers for equality |