/** Divide two complex numbers, in-place */ public Complex divi(Complex c, Complex result) { float d = c.re * c.re + c.im * c.im; float newre = (re * c.re + im * c.im) / d; float newim = (im * c.re - re * c.im) / d; result.re = newre; result.im = newim; return result; }
public Complex divi(float v, Complex result) { if (this == result) { re /= v; im /= v; } else { result.re = re / v; result.im = im / v; } return this; }