This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Complex type | |
var Complex = function (real, imag) { | |
if (real instanceof Complex) return real; | |
imag = imag || 0; | |
return Object.freeze(Object.create(Complex.prototype, { | |
real: {value: real, enumerable: true}, | |
imag: {value: imag, enumerable: true}, | |
})); | |
}; | |
Complex.fromPolar = function (r, theta) { |