DoxigAlpha

div

Returns the quotient of two complex numbers.

Function parameters

Parameters

#

Functions in this namespace

Functions

#
Complex
A complex number consisting of a real an imaginary part.

Source

Implementation

#
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,
    };
}