std › math › complex.Complex › divdivReturns the quotient of two complex numbers. Function parametersParameters#self:Selfother:SelfFunctions in this namespaceFunctions#absacoshacosargasinhasinatanhatanconjcoshcosexplogpowprojsinhsinsqrttanhtanComplex A complex number consisting of a real an imaginary part.SourceImplementation#pub fn div(self: Self, other: Self) Self { const re_num = self.re * other.re + self.im * other.im; const im_num = self.im * other.re - self.re * other.im; const den = other.re * other.re + other.im * other.im; return Self{ .re = re_num / den, .im = im_num / den, }; }
pub fn div(self: Self, other: Self) Self { const re_num = self.re * other.re + self.im * other.im; const im_num = self.im * other.re - self.re * other.im; const den = other.re * other.re + other.im * other.im; return Self{ .re = re_num / den, .im = im_num / den, }; }